Started work on toke logic

This commit is contained in:
rainbow napkin 2024-12-13 18:28:48 -05:00
parent 5fe1620c20
commit d85f906a69
7 changed files with 160 additions and 16 deletions

View file

@ -79,14 +79,26 @@ module.exports = class{
}
}
relayChat(socket, msg, type = 'chat'){
relayUserChat(socket, msg, type){
const user = this.server.getSocketInfo(socket);
this.server.io.in(socket.chan).emit("chatMessage", {user: user.user, flair: user.flair, highLevel: user.highLevel, msg, type});
this.relayChat(user.user, user.flair, user.highLevel, msg, type, socket.chan)
}
relayChat(user, flair, highLevel, msg, type = 'chat', chan){
this.server.io.in(chan).emit("chatMessage", {user, flair, highLevel, msg, type});
}
relayGlobalChat(user, flair, highLevel, msg, type = 'chat'){
this.server.io.emit("chatMessage", {user, flair, highLevel, msg, type});
}
relayTokeCallout(msg){
this.relayGlobalChat("Tokebot", "", 10, msg, "toke");
}
relayServerAnnouncement(msg){
//This codebase is always at a 10
this.server.io.emit("chatMessage", {user: "Server", flair: "", highLevel: 10, msg, type: "announcement"});
this.relayGlobalChat("Server", "", 10, msg, "announcement");
}
relayChannelAnnouncement(chan, msg){
@ -95,7 +107,7 @@ module.exports = class{
//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"});
this.relayChat("Channel", "", 10, msg, "announcement", chan);
}
}