Skip to content

Instantly share code, notes, and snippets.

@w3cj
Created November 22, 2019 17:59
Show Gist options
  • Save w3cj/5f9bdf240944051d54144312368f0780 to your computer and use it in GitHub Desktop.
Save w3cj/5f9bdf240944051d54144312368f0780 to your computer and use it in GitHub Desktop.
const tmi = require('tmi.js');
module.exports = async function (context, myTimer) {
var timeStamp = new Date().toISOString();
if (myTimer.IsPastDue)
{
context.log('Timer running late...');
}
context.log('Timer triggered:', timeStamp);
const client = new tmi.Client({
connection: {
secure: true,
reconnect: true
},
identity: {
username: 'bot-username-here',
password: 'bot-oauth-token-here'
},
channels: [ 'channel-name-here' ]
});
client.on('connected', async () => {
try {
await client.say('channel-name-here', '💧💧💧 This is a friendly reminder to hydrate. 💧💧💧');
} catch (error) {
context.log('Error sending message:', error.message);
context.log(error);
await client.disconnect();
}
});
await client.connect();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment