i hate js. it ignores all of my code and just sends 'messagetype' instead of 'type'

This commit is contained in:
MrMasrozYTLIVE 2024-06-14 19:25:17 +03:00
parent 14aa129f6d
commit 9b4357dd00
2 changed files with 4 additions and 4 deletions

View File

@ -39,9 +39,9 @@ loadCommands().then(commands => {
// We use Event Emitter here to handle new messages // We use Event Emitter here to handle new messages
bot.on('onMessage', (peer, message) => { 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 // Check if the message starts with a command prefix
if (message.message.startsWith('!')) { if (message.message.startsWith('!')) {

View File

@ -1,6 +1,6 @@
class Message { class Message {
constructor(messageType, peerName, peerAvatar, topic, timestamp) { constructor(messageType, peerName, peerAvatar, topic, timestamp) {
this.messageType = messageType; this.type = messageType;
this.peerName = peerName; this.peerName = peerName;
this.peerAvatar = peerAvatar; this.peerAvatar = peerAvatar;
this.topic = topic; this.topic = topic;
@ -9,7 +9,7 @@ class Message {
toJson() { toJson() {
return { return {
type: this.messageType, type: this.type,
name: this.peerName, name: this.peerName,
avatar: this.peerAvatar, avatar: this.peerAvatar,
topic: this.topic, topic: this.topic,