Started working on proper classes for messages (files and text), user peer class, chatroom class

This commit is contained in:
MrMasrozYTLIVE 2024-06-10 21:34:50 +03:00
parent 92ba56b9fc
commit edf61f0462
6 changed files with 33 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import fs from 'fs';
import path from 'path';
import Client from './includes/client.js'; // Adjust the import path as necessary
import Client from './includes/Client.js'; // Adjust the import path as necessary
import 'dotenv/config';
// Create a new instance of the chatBot class with a valid botName

View File

@ -3,8 +3,6 @@ class ChatRoom {
this.topic = topic;
this.peers = peers;
}
}
export default ChatRoom;

View File

@ -0,0 +1,12 @@
class FileMessage {
public FileMessage(chatRoom, userPeer, fileName, fileUrl, fileType, timestamp) {
this.chatRoom = chatRoom;
this.userPeer = userPeer;
this.fileName = fileName;
this.fileUrl = fileUrl;
this.fileType = fileType;
this.timestamp = timestamp;
}
}
export default FileMessage;

View File

@ -0,0 +1,10 @@
class TextMessage {
public TextMessage(chatRoom, userPeer, message, timestamp) {
this.chatRoom = chatRoom;
this.userPeer = userPeer;
this.message = message;
this.timestamp = timestamp;
}
}
export default TextMessage;

View File

@ -0,0 +1,10 @@
class UserPeer {
public UserPeer(peer, topics, username, avatar) {
this.peer = peer;
this.topics = topics;
this.username = username;
this.avatar = avatar;
}
}
export default UserPeer;