properly support guild update events

This commit is contained in:
Cadence Ember 2023-09-04 01:36:35 +12:00
parent 5e6bb0cd2e
commit d3f637d7ce

View file

@ -43,6 +43,15 @@ const utils = {
}
eventDispatcher.checkMissedMessages(client, message.d)
} else if (message.t === "GUILD_UPDATE") {
const guild = client.guilds.get(message.d.id)
if (guild) {
for (const prop of Object.keys(message.d)) {
if (!["channels", "threads"].includes(prop)) {
guild[prop] = message.d[prop]
}
}
}
} else if (message.t === "THREAD_CREATE") {
client.channels.set(message.d.id, message.d)