Skip to content

Instantly share code, notes, and snippets.

@hfitzwater
Last active April 14, 2021 20:32
Show Gist options
  • Save hfitzwater/97377697704e22d8382d2ae30caf3169 to your computer and use it in GitHub Desktop.
Save hfitzwater/97377697704e22d8382d2ae30caf3169 to your computer and use it in GitHub Desktop.
Autodrop
#!/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