Added !clear command

This commit is contained in:
rainbow napkin 2024-12-10 18:51:21 -05:00
parent df18b4d783
commit f8efe5b99e
6 changed files with 79 additions and 14 deletions

View file

@ -22,7 +22,7 @@ const {userModel} = require('../../schemas/userSchema');
module.exports = class{
constructor(server){
this.server = server;
this.commandPreprocessor = new commandPreprocessor(server)
this.commandPreprocessor = new commandPreprocessor(server, this)
}
defineListeners(socket){
@ -89,8 +89,27 @@ module.exports = class{
this.server.io.emit("chatMessage", {user: "Server", flair: "", highLevel: 10, msg, type: "announcement"});
}
relayChannelAnnouncement(socket, msg){
//This codebase is always at a 10
this.server.io.in(socket.chan).emit("chatMessage", {user: "Channel", flair: "", highLevel: 10, msg, type: "announcement"});
relayChannelAnnouncement(chan, msg){
const activeChan = this.server.activeChannels.get(chan);
//If channel isn't null
if(activeChan != null){
//This codebase is always at a 10
this.server.io.in(chan).emit("chatMessage", {user: "Channel", flair: "", highLevel: 10, msg, type: "announcement"});
}
}
clearChat(chan, user){
const activeChan = this.server.activeChannels.get(chan);
//If channel isn't null
if(activeChan != null){
const target = activeChan.userList.get(user);
//If no user was entered OR the user was found
if(user == null || target != null){
this.server.io.in(chan).emit("clearChat", {user});
}
}
}
}