Reworked message format, added support for audio messages, made Message class #10
@ -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('!')) {
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user