tb-bot
v1.1.5
Published
A library for easily creating Trollbox bots
Downloads
95
Readme
tb-bot
A library that allows you to easily create Trollbox bots.
Usage:
var Bot = require('tb-bot');
var bot = new Bot();
var chatKing = {}
bot.join({ nick: 't!testbot', color: 'lightgreen' })
bot.on('message', (data) => {
if(data.message == 't!help') {
bot.send('won\'t help ya')
}
if(data.message == 't!myhome') {
bot.send('my home: ' + bot.home())
}
if(data.message == 't!afk') {
bot.room('afk')
}
if(data.message == 't!atrium') {
bot.room('atrium')
}
if(data.message == 't!myroom') {
bot.send('my room: ' + bot.room())
}
if(data.message == 't!name') {
bot.join({ nick: 't!testing' })
}
if(data.message == 't!ogname') {
bot.join({ nick: 't!testbot' })
}
})
bot.on('user', (data, action) => {
if(action == 'join') {
bot.send(`hi, ${data.nick}`)
}
if(action == 'leave') {
bot.send(`${data.nick} left :(`)
}
if(action == 'update') {
if(data.chatKing.nick !== chatKing.nick) {
chatKing = data.chatKing
setTimeout(() => {
bot.send(`${chatKing.nick} is now the chat king!`)
}, 1200)
}
console.log('leaderboard:', data.userList)
}
})
Changelog
v1.1
- Nick or color on second join is optional
- You can now get the nick and color of the bot using
bot.nick()
andbot.color()