mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
fix: ignore GUILD_DELETE events for unavailable guilds in big bot template (#2412)
* fix: ignore GUILD_DELETE events for unavailable guilds in big bot template * update worker.ts Co-authored-by: LTS20050703 <lts20050703@gmail.com> * fix: small stuff Co-authored-by: LTS20050703 <lts20050703@gmail.com>
This commit is contained in:
co-authored by
LTS20050703
parent
ae669e28fe
commit
73452f43f5
@@ -1,4 +1,4 @@
|
||||
import { createShardManager, Shard, ShardSocketRequest, ShardState } from "discordeno";
|
||||
import { createShardManager, DiscordUnavailableGuild, Shard, ShardSocketRequest, ShardState } from "discordeno";
|
||||
import { createLogger } from "discordeno/logger";
|
||||
import { parentPort, workerData } from "worker_threads";
|
||||
import { ManagerMessage } from "./index.js";
|
||||
@@ -24,6 +24,9 @@ const manager = createShardManager({
|
||||
const url = script.handlerUrls[shard.id % script.handlerUrls.length];
|
||||
if (!url) return console.log("ERROR: NO URL FOUND TO SEND MESSAGE");
|
||||
|
||||
// MUST HANDLE GUILD_DELETE EVENTS FOR UNAVAILABLE
|
||||
if (message.t === "GUILD_DELETE" && (message.d as DiscordUnavailableGuild).unavailable) return;
|
||||
|
||||
await fetch(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ message, shardId: shard.id }),
|
||||
|
||||
Reference in New Issue
Block a user