mirror of
https://github.com/MathMan05/Fermi.git
synced 2026-05-24 13:05:31 +00:00
handle message_ack
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user