msg reaction remove all & emoji gateway event

This commit is contained in:
TomatoCake 2024-08-25 18:36:30 +02:00
parent 1de4767c6d
commit b366381e53
2 changed files with 30 additions and 4 deletions

View file

@ -509,7 +509,7 @@ class Message{
}
func();
}
makeReaction(data:{name:string},member:Member|{id:string}){
reactionAdd(data:{name:string},member:Member|{id:string}){
for(const thing of this.reactions){
if(thing.emoji.name===data.name){
thing.count++;
@ -527,7 +527,7 @@ class Message{
});
this.updateReactions();
}
removeReaction(data:{name:string},id:string){
reactionRemove(data:{name:string},id:string){
console.log("test");
for(const i in this.reactions){
const thing=this.reactions[i];
@ -547,6 +547,20 @@ class Message{
}
}
}
reactionRemoveAll() {
this.reactions = [];
this.updateReactions();
}
reactionRemoveEmoji(emoji:Emoji) {
for (const i in this.reactions) {
const reaction = this.reactions[i];
if ((reaction.emoji.id && reaction.emoji.id == emoji.id) || (!reaction.emoji.id && reaction.emoji.name == emoji.name)) {
this.reactions.splice(i, 1);
this.updateReactions();
break;
}
}
}
buildhtml(premessage:Message|undefined=undefined){
if(this.div){console.error(`HTML for ${this.snowflake} already exists, aborting`);return;}
try{