handle message_ack

This commit is contained in:
MathMan05
2025-12-03 10:28:40 -06:00
parent 26653a82e3
commit 65c37105e8
2 changed files with 30 additions and 0 deletions
+10
View File
@@ -978,6 +978,16 @@ type wsjson =
user: userjson;
};
s: number;
}
| {
op: 0;
t: "MESSAGE_ACK";
d: {
channel_id: string;
message_id: string;
version: number; //I don't think this really matters lol
};
s: number;
};
export interface interactionCreate {
+20
View File
@@ -249,6 +249,17 @@ class Localuser {
mic.classList.add("svg-mic");
}
}
channelByID(id: string): Channel | void {
let channel: Channel | void = undefined;
this.guilds.forEach((_) => {
_.channels.forEach((_) => {
if (_.id === id) {
channel = _;
}
});
});
return channel;
}
trace: {trace: trace; time: Date}[] = [];
handleTrace(str: string[]) {
const json = str.map((_) => JSON.parse(_)) as trace[];
@@ -940,6 +951,15 @@ class Localuser {
channel.addRec(new User(temp.d.user, this));
break;
}
case "MESSAGE_ACK": {
const channel = this.channelByID(temp.d.channel_id);
if (!channel) break;
channel.lastreadmessageid = temp.d.message_id;
channel.mentions = 0;
channel.unreads();
channel.guild.unreads();
break;
}
default: {
//@ts-expect-error