Created
November 22, 2019 17:59
-
-
Save w3cj/5f9bdf240944051d54144312368f0780 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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