DemoBot: replying to mentions.

This commit is contained in:
John Livingston
2021-12-08 16:54:22 +01:00
parent 4efc507b2c
commit 8dc09307f3
3 changed files with 57 additions and 0 deletions

View File

@ -44,6 +44,14 @@ export class BotHandlerDemo extends BotHandler {
room.sendGroupchat(msg).catch(() => {})
})
room.on('room_message', (msg: string, user?: XMPPUser, mentionned?: boolean) => {
if (!user || user.isMe) { return }
if (!room.isOnline()) { return }
if (!mentionned) { return }
room.sendGroupchat(`Yep @${user.nick}?`).catch(() => {})
})
this.randomTimeout = setInterval(() => {
this.sendRandomMessage()
}, 10 * 1000)