Started working on proper classes for messages (files and text), user peer class, chatroom class
This commit is contained in:
parent
92ba56b9fc
commit
edf61f0462
@ -1,6 +1,6 @@
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
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';
|
import 'dotenv/config';
|
||||||
|
|
||||||
// Create a new instance of the chatBot class with a valid botName
|
// Create a new instance of the chatBot class with a valid botName
|
||||||
|
@ -3,8 +3,6 @@ class ChatRoom {
|
|||||||
this.topic = topic;
|
this.topic = topic;
|
||||||
this.peers = peers;
|
this.peers = peers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ChatRoom;
|
export default ChatRoom;
|
12
chatBot/includes/FileMessage.js
Normal file
12
chatBot/includes/FileMessage.js
Normal 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;
|
10
chatBot/includes/TextMessage.js
Normal file
10
chatBot/includes/TextMessage.js
Normal 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;
|
10
chatBot/includes/UserPeer.js
Normal file
10
chatBot/includes/UserPeer.js
Normal 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;
|
Loading…
Reference in New Issue
Block a user