Boto/node/boto.js

89 lines
2.2 KiB
JavaScript
Raw Normal View History

2022-02-11 08:03:21 +00:00
// B O T O
2022-02-13 14:21:44 +00:00
// ---
2022-02-14 09:25:11 +00:00
// black
2022-02-13 14:21:44 +00:00
// red
// green
// yellow
// blue
// magenta
// cyan
2022-02-14 09:25:11 +00:00
// white
// gray
// grey
// brightRed
// brightGreen
// brightYellow
// brightBlue
// brightMagenta
// brightCyan
// brightWhite
2022-02-13 14:21:44 +00:00
2022-02-09 06:55:26 +00:00
require('dotenv').config();
2022-02-11 10:44:16 +00:00
const tmi = require('tmi.js');
2022-02-13 14:27:53 +00:00
const rp = require('request-promise'); // For RNG
const colors = require('colors');
2022-02-09 06:55:26 +00:00
console.log(process.env.API_HOST);
const client = new tmi.Client({
options: { debug: true },
connection: {
secure: true,
reconnect: true
},
identity: {
username: process.env.TTV_BOT_USERNAME,
password: process.env.TTV_BOT_OAUTH
},
channels: [ process.env.TTV_CHANNELS ]
});
client.connect();
2022-02-14 09:46:55 +00:00
import { rnguser } from "./rng.js";
rnguser();
2022-02-12 22:28:55 +00:00
2022-02-12 05:08:18 +00:00
// SCAN MSG | START
2022-02-12 22:42:00 +00:00
client.on('message', (channel, tags, message, self) => {
2022-02-12 05:08:18 +00:00
if(self) return;
const badges = tags.badges || {}; // Scan Badges
const isBroadcaster = badges.broadcaster; // Define Streamer
const isMod = badges.moderator; // Define Mod
const isModUp = isBroadcaster || isMod; // Permission Merge = Mod+Streamer
const isSub = badges.subscriber || badges.founder; // Define Subs
const botUserState = client.userstate[channel]; // MOD Status Check
const amMod = botUserState !== undefined && botUserState.mod === true; // Define Mod Status
2022-02-11 11:06:26 +00:00
2022-02-12 05:08:18 +00:00
if(self || !message.startsWith('!')) return; // Command Parser
const args = message.slice(1).split(' ');
const command = args.shift().toLowerCase(); // !COMMAND => command
2022-02-12 05:26:12 +00:00
2022-02-12 20:53:52 +00:00
// TODO:
// Uptime
// Viewers
// Followage
// Followers
2022-02-12 18:33:43 +00:00
// CHAT COMMANDS | End
2022-02-14 10:11:24 +00:00
// import { cmd_general } from "./cmd/general.js";
// cmd_general();
// import { cmd_subs } from "./cmd/subs.js";
// cmd_suds();
// import { cmd_mods } from "./cmd/mods.js";
// cmd_mods();
2022-02-12 07:21:15 +00:00
2022-02-12 05:37:45 +00:00
}); // SCAN MSG | END
// TTV Re-Active
// ==================================
2022-02-12 19:26:39 +00:00
// TO-DO: Add Follower API
2022-02-12 19:55:28 +00:00
// https://api.twitch.tv/kraken/channels/MY_ID/follows?api_version=5&client_id=MY_CLIENT_ID&limit=1
2022-02-13 00:13:37 +00:00
2022-02-13 00:46:27 +00:00
// client.on("action", (channel, userstate, message, self) => {
// // Don't listen to my own messages..
// if (self) return;
// console.log('LOG: Action ');
// });
2022-02-14 10:11:24 +00:00
// import { ttv_alerts } from "./alerts.js";
// ttv_alerts();