Add 'server/mmoirc.js'

This commit is contained in:
Sarimoko 2022-02-10 07:23:32 +00:00
parent 7878b0bbc9
commit 9bab4768d0
1 changed files with 22 additions and 0 deletions

22
server/mmoirc.js Normal file
View File

@ -0,0 +1,22 @@
const tmi = require('tmi.js');
const client = new tmi.Client({
options: { debug: true },
identity: {
username: 'my_bot_name',
password: 'oauth:my_bot_token'
},
channels: [ 'my_name' ]
});
client.connect();
client.on('message', (channel, tags, message, self) => {
// Ignore echoed messages.
if(self) return;
if(message.toLowerCase() === '!hello') {
// "@alca, heya!"
client.say(channel, `@${tags.username}, heya!`);
}
});