mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
Merge pull request #1731 from TriForMine/patch-15
Fix: dispatchRequirements
This commit is contained in:
@@ -46,19 +46,19 @@ export async function dispatchRequirements(bot: Bot, data: DiscordGatewayPayload
|
||||
// New guild id has appeared, fetch all relevant data
|
||||
bot.events.debug(`[DISPATCH] New Guild ID has appeared: ${id} in ${data.t} event`);
|
||||
|
||||
const rawGuild = (await bot.helpers
|
||||
const guild = (await bot.helpers
|
||||
.getGuild(id, {
|
||||
counts: true,
|
||||
addToCache: false,
|
||||
})
|
||||
.catch(console.log)) as SnakeCasedPropertiesDeep<Guild> | undefined;
|
||||
|
||||
if (!rawGuild) {
|
||||
if (!guild) {
|
||||
processing.delete(id);
|
||||
return bot.events.debug(`[DISPATCH] Guild ID ${id} failed to fetch.`);
|
||||
}
|
||||
|
||||
bot.events.debug(`[DISPATCH] Guild ID ${id} has been found. ${rawGuild.name}`);
|
||||
bot.events.debug(`[DISPATCH] Guild ID ${id} has been found. ${guild.name}`);
|
||||
|
||||
const [channels, botMember] = await Promise.all([
|
||||
bot.helpers.getChannels(id, false),
|
||||
@@ -71,18 +71,10 @@ export async function dispatchRequirements(bot: Bot, data: DiscordGatewayPayload
|
||||
if (!botMember || !channels) {
|
||||
processing.delete(id);
|
||||
return bot.events.debug(
|
||||
`[DISPATCH] Guild ID ${id} Name: ${rawGuild.name} failed. Unable to get botMember or channels`
|
||||
`[DISPATCH] Guild ID ${id} Name: ${guild.name} failed. Unable to get botMember or channels`
|
||||
);
|
||||
}
|
||||
|
||||
const guild = bot.transformers.guild(bot, {
|
||||
guild: {
|
||||
...rawGuild,
|
||||
member_count: rawGuild.approximate_member_count,
|
||||
},
|
||||
shardId,
|
||||
});
|
||||
|
||||
// Add to cache
|
||||
await bot.cache.guilds.set(id, guild);
|
||||
bot.cache.dispatchedGuildIds.delete(id);
|
||||
|
||||
Reference in New Issue
Block a user