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

@ -70,11 +70,16 @@ a{
color: var(--accent0);
}
a:hover{
a:hover, i:hover{
color: var(--focus0-alt0);
text-shadow: var(--focus-glow0);
}
a:active, i:active{
color: var(--focus0-alt1);
box-shadow: var(--focus-glow0-alt0);
}
select{
background-color: var(--bg2);
border-radius: 0.5em;

View file

@ -71,8 +71,22 @@ class chatBox{
}
defineListeners(){
this.client.socket.on("chatMessage", (data) => {
this.displayChat(data);
this.client.socket.on("chatMessage", this.displayChat.bind(this));
this.client.socket.on("clearChat", this.clearChat.bind(this));
}
clearChat(data){
//If we where passed a user to check
if(data.user != null){
var clearedChats = document.querySelectorAll(`.chat-entry-${data.user}`);
}else{
var clearedChats = document.querySelectorAll('.chat-entry');
}
//For each chat found
clearedChats.forEach((chat) => {
//fuckin' nukem!
chat.remove();
});
}