Last active
April 14, 2021 20:32
-
-
Save hfitzwater/97377697704e22d8382d2ae30caf3169 to your computer and use it in GitHub Desktop.
Autodrop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/* | |
Auto drop for pixelplush.dev :) | |
Usage: | |
node index.js start [username] [oauthToken] [channel_name] | |
*/ | |
const tmi = require('tmi.js'); | |
const yargs = require('yargs/yargs'); | |
const defaultTimeout = 90000; | |
const defaultCommand = '!drop'; | |
const [cmd, username, oauthToken, channel] = yargs(process.argv.slice(2)).argv._; | |
let shouldRespond = true; | |
setInterval(() => { | |
shouldRespond = true; | |
}, defaultTimeout ); | |
const client = new tmi.Client({ | |
connection: { reconnect: true }, | |
identity: { | |
username: username, | |
password: oauthToken | |
}, | |
channels: [ channel ] | |
}); | |
client.connect(); | |
client.on('message', (c, tags, message, self) => { | |
if( shouldRespond && message === defaultCommand ) { | |
shouldRespond = false; | |
client.say(c, defaultCommand) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment