Some more changed to the bot structure #2
@ -61,15 +61,10 @@ loadCommands().then(commands => {
|
||||
|
||||
bot.on('onBotJoinRoom', () => {
|
||||
console.log("Bot is ready!");
|
||||
bot.sendMessage(process.env.ON_READY_MESSAGE);
|
||||
});
|
||||
|
||||
bot.joinChatRoom();
|
||||
|
||||
// Wait for 2 seconds for the bot to connect
|
||||
setTimeout(() => {
|
||||
// Send a message
|
||||
bot.sendMessage(process.env.ON_READY_MESSAGE);
|
||||
}, 2000); // Adjust the delay as necessary
|
||||
}).catch(error => {
|
||||
console.error('Error loading commands:', error);
|
||||
});
|
||||
|
@ -27,8 +27,8 @@ class Client extends EventEmitter {
|
||||
joinChatRoom() {
|
||||
this.discovery = this.swarm.join(this.topicBuffer, {client: true, server: true});
|
||||
this.discovery.flushed().then(() => {
|
||||
this.emit('onBotJoinRoom')
|
||||
console.log(`Bot ${this.botName} joined the chat room.`);
|
||||
this.emit('onBotJoinRoom');
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user