From 09ab23b43e36138ac8dc8e15f3fa95726a8e96cd Mon Sep 17 00:00:00 2001 From: Sarimoko Date: Wed, 9 Feb 2022 06:55:26 +0000 Subject: [PATCH] Add 'node/boto.js' --- node/boto.js | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 node/boto.js diff --git a/node/boto.js b/node/boto.js new file mode 100644 index 0000000..3adb260 --- /dev/null +++ b/node/boto.js @@ -0,0 +1,57 @@ +const tmi = require('tmi.js'); +require('dotenv').config(); + +console.log(process.env.API_HOST); + +const client = new tmi.Client({ + options: { debug: true }, + connection: { + secure: true, + reconnect: true + }, + identity: { + //username: 'sariboto', + username: process.env.TTV_BOT_USERNAME, + password: process.env.TTV_BOT_OAUTH + }, + //channels: [ 'sarimoko' ] + channels: [ process.env.TTV_CHANNELS ] +}); + +client.connect(); + +client.on('message', (channel, tags, message, self) => { + if(self) return; + const badges = tags.badges || {}; + const isBroadcaster = badges.broadcaster; + const isMod = badges.moderator; + const isModUp = isBroadcaster || isMod; +}); + +client.on('message', (channel, tags, message, self) => { + if(self || !message.startsWith('!')) return; + + const args = message.slice(1).split(' '); + const command = args.shift().toLowerCase(); + + const botUserState = client.userstate[channel]; + const amMod = botUserState !== undefined && botUserState.mod === true; + + // The Boto + if(command === 'boto' || command === 'sariboto' || command === 'sari-boto') { + client.say(channel, `/me Bleep! Bloop! Successfully connected to Twitch!`); + client.say(channel, `!kappagen imGlitch EarthDay imGlitch EarthDay imGlitch`); + } + + // The Echo + else if(command === 'echo') { + client.say(channel, `/me Off in the distance @${tags.username} screams...`); + client.say(channel, `" ${args.join(' ')} ${args.join(' ')} ${args.join(' ')} ${args.join(' ')} ${args.join(' ')} " can be heard to all those around!`); + } + + + // NOT FOUND FUNCTION + else { + client.say(channel, `/me Bleep! Bloop! Command NOT found! Sorry, @${tags.username} but did you typo it?`); + } +});