Added Event enum and 2 new events

This commit is contained in:
MrMasrozYTLIVE
2024-06-08 23:29:51 +03:00
parent 114875cddb
commit b244aa9bdf
2 changed files with 20 additions and 5 deletions

View File

@ -38,7 +38,7 @@ loadCommands().then(commands => {
const bot = new Client(process.env.LINKUP_ROOM_ID, botName);
// We use Event Emitter here to handle new messages
bot.on('onMessage', (peer, message) => {
bot.on(Event.onMessage, (peer, message) => {
if (message.type == "icon") return;
console.log(message);
@ -57,7 +57,12 @@ loadCommands().then(commands => {
commandHandler.handler(bot, args, message);
}
}
})
});
bot.on(Event.onBotJoinRoom, () => {
console.log("Bot is ready!");
});
bot.joinChatRoom();
// Wait for 2 seconds for the bot to connect