Skip to content

Instantly share code, notes, and snippets.

@AllGistsEqual
Created January 25, 2021 21:29
Show Gist options
  • Save AllGistsEqual/797e73e110355126399663f65a8367bc to your computer and use it in GitHub Desktop.
Save AllGistsEqual/797e73e110355126399663f65a8367bc to your computer and use it in GitHub Desktop.
// Check and react to messages
bot.onMessage = async function onMessage(message) {
/*
* THIS IS WHERE OUR OLD CODE REMAINS
* => if ping
* => if no prefix
* => if who
* => if whois with/without mention
*/
}
/*
* Register event listeners
*/
bot.client.on('ready', bot.onConnect.bind(bot))
bot.client.on('error', err => {
bot.log(`Client error: ${err.message}`)
})
bot.client.on('reconnecting', () => {
bot.log('Reconnecting...')
})
bot.client.on('disconnect', evt => {
bot.log(`Disconnected: ${evt.reason} (${evt.code})`)
})
bot.client.on('message', bot.onMessage.bind(bot))
// start the bot
bot.load()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment