Got rid of 2 useless classes

This commit is contained in:
MrMasrozYTLIVE 2024-06-11 20:56:02 +03:00
parent 5bb5e63105
commit 4aa205cd73
3 changed files with 2 additions and 34 deletions

View File

@ -1,8 +0,0 @@
class ChatRoom {
public ChatRoom(topic, peers) {
this.topic = topic;
this.peers = peers;
}
}
export default ChatRoom;

View File

@ -46,22 +46,8 @@ class Client extends EventEmitter {
}); });
} }
sendMessage(roomPeers, message) { // TODO: Make topic here actually work.
console.log('Bot name:', this.botName); sendMessage(topic, message) {
const timestamp = Date.now();
const messageObj = {
type: 'message',
name: this.botName,
message,
timestamp,
topic: this.currentTopic // Include the current topic
};
const data = JSON.stringify(messageObj);
const peers = [...this.swarm.connections].filter(peer => roomPeers.includes(peer.remotePublicKey.toString('hex')));
for (const peer of peers) peer.write(data);
}
sendMessageToAll(message) {
console.log('Bot name:', this.botName); console.log('Bot name:', this.botName);
const timestamp = Date.now(); const timestamp = Date.now();
const messageObj = { const messageObj = {

View File

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