Server now seperates links and media. Client now embeds links, but not media.

This commit is contained in:
rainbow napkin 2024-12-16 09:01:41 -05:00
parent a83dbdcb7f
commit 23df4f88f9
4 changed files with 141 additions and 58 deletions

View file

@ -79,45 +79,45 @@ module.exports = class{
}
}
relayUserChat(socket, msg, type){
relayUserChat(socket, msg, type, links){
const user = this.server.getSocketInfo(socket);
this.relayChat(user.user, user.flair, user.highLevel, msg, type, socket.chan)
this.relayChat(user.user, user.flair, user.highLevel, msg, type, socket.chan, links)
}
relayChat(user, flair, highLevel, msg, type = 'chat', chan){
this.server.io.in(chan).emit("chatMessage", {user, flair, highLevel, msg, type});
relayChat(user, flair, highLevel, msg, type = 'chat', chan, links){
this.server.io.in(chan).emit("chatMessage", {user, flair, highLevel, msg, type, links});
}
relayServerWisper(socket, user, flair, highLevel, msg, type){
socket.emit("chatMessage", {user, flair, highLevel, msg, type});
relayServerWisper(socket, user, flair, highLevel, msg, type, links){
socket.emit("chatMessage", {user, flair, highLevel, msg, type, links});
}
relayGlobalChat(user, flair, highLevel, msg, type = 'chat'){
this.server.io.emit("chatMessage", {user, flair, highLevel, msg, type});
relayGlobalChat(user, flair, highLevel, msg, type = 'chat', links){
this.server.io.emit("chatMessage", {user, flair, highLevel, msg, type, links});
}
relayTokeCallout(msg){
this.relayGlobalChat("Tokebot", "", '∞', msg, "toke");
relayTokeCallout(msg, links){
this.relayGlobalChat("Tokebot", "", '∞', msg, "toke", links);
}
relayTokeWhisper(socket, msg){
this.relayServerWisper(socket, "Tokebot", "", '∞', msg, "tokewhisper");
relayTokeWhisper(socket, msg, links){
this.relayServerWisper(socket, "Tokebot", "", '∞', msg, "tokewhisper", links);
}
relayGlobalTokeWhisper(msg){
this.relayGlobalChat("Tokebot", "", '∞', msg, "tokewhisper");
relayGlobalTokeWhisper(msg, links){
this.relayGlobalChat("Tokebot", "", '∞', msg, "tokewhisper", links);
}
relayServerAnnouncement(msg){
this.relayGlobalChat("Server", "", '∞', msg, "announcement");
relayServerAnnouncement(msg, links){
this.relayGlobalChat("Server", "", '∞', msg, "announcement", links);
}
relayChannelAnnouncement(chan, msg){
relayChannelAnnouncement(chan, msg, links){
const activeChan = this.server.activeChannels.get(chan);
//If channel isn't null
if(activeChan != null){
this.relayChat("Channel", "", '∞', msg, "announcement", chan);
this.relayChat("Channel", "", '∞', msg, "announcement", chan, links);
}
}