partial thread event support
This commit is contained in:
parent
2ec57a2b11
commit
2205245353
1 changed files with 16 additions and 0 deletions
16
src/index.js
16
src/index.js
|
@ -118,6 +118,22 @@ bot.once("ready", async function () {
|
||||||
await cacheThreads(guilds.next().value);
|
await cacheThreads(guilds.next().value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
bot.on("unknown", (packet) => {
|
||||||
|
if (packet.t == "THREAD_CREATE") {
|
||||||
|
const guild = bot.guilds.get(packet.d.guild_id);
|
||||||
|
if (!guild) {
|
||||||
|
logger.warn(
|
||||||
|
`Got THREAD_CREATE from invalid guild??? id: ${packet.d.guild_id}`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
guild.channels.set(packet.d.id, new Eris.TextChannel(packet.d, bot));
|
||||||
|
}
|
||||||
|
} else if (packet.t == "THREAD_DELETE") {
|
||||||
|
const guild = bot.guilds.get(packet.d.guild_id);
|
||||||
|
guild.channels.delete(packet.d.id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
bot.on("error", (err) => {
|
bot.on("error", (err) => {
|
||||||
logger.error("hf:main", "Catching error: " + err);
|
logger.error("hf:main", "Catching error: " + err);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue