From 9b4357dd00164f0a671d1270deb793f7c2ac838b Mon Sep 17 00:00:00 2001 From: MrMasrozYTLIVE <61359286+MrMasrozYTLIVE@users.noreply.github.com> Date: Fri, 14 Jun 2024 19:25:17 +0300 Subject: [PATCH] i hate js. it ignores all of my code and just sends 'messagetype' instead of 'type' --- chatBot/bot.js | 4 ++-- chatBot/includes/Message.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/chatBot/bot.js b/chatBot/bot.js index 663c46c..9757135 100644 --- a/chatBot/bot.js +++ b/chatBot/bot.js @@ -39,9 +39,9 @@ loadCommands().then(commands => { // We use Event Emitter here to handle new messages bot.on('onMessage', (peer, message) => { - // console.log(message); - console.log(`Message received from ${message.peerName}@${message.topic} at ${new Date(message.timestamp).toLocaleTimeString()}: ${message.message}`); + console.log(`Message received from ${message.peerName} at ${new Date(message.timestamp).toLocaleTimeString()}: ${message.message}`); + console.log(message); // Check if the message starts with a command prefix if (message.message.startsWith('!')) { diff --git a/chatBot/includes/Message.js b/chatBot/includes/Message.js index 9f6f4e4..fbb2fff 100644 --- a/chatBot/includes/Message.js +++ b/chatBot/includes/Message.js @@ -1,6 +1,6 @@ class Message { constructor(messageType, peerName, peerAvatar, topic, timestamp) { - this.messageType = messageType; + this.type = messageType; this.peerName = peerName; this.peerAvatar = peerAvatar; this.topic = topic; @@ -9,7 +9,7 @@ class Message { toJson() { return { - type: this.messageType, + type: this.type, name: this.peerName, avatar: this.peerAvatar, topic: this.topic,