import tmi from 'tmi.js'; const client = new tmi.Client({ options: { debug: true }, identity: { username: process.env.MIX_TWITCH_BOT_USERNAME, password: process.env.MIX_TWITCH_BOT_OAUTH_TOKEN }, channels: [ process.env.MIX_TWITCH_CHANNEL ] }); client.connect().catch(console.error); client.on('message', (channel, tags, message, self) => { if(self) return; if(message.toLowerCase() === '!roll') { const num = Math.floor(Math.random() * 6) + 1; client.say(channel, `@${tags.username} rolled a ${num}`); } });