Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GuildDelete event triggers every time bot starts #5350

Closed
DomDom3333 opened this issue Feb 23, 2021 · 8 comments
Closed

GuildDelete event triggers every time bot starts #5350

DomDom3333 opened this issue Feb 23, 2021 · 8 comments

Comments

@DomDom3333
Copy link

Please describe the problem you are having in as much detail as possible:
Every time I start the bot, the guildDelete event triggers. However while the guild object is valid, the name and member count is undefined. This results in an error.

Include a reproducible code sample here, if possible:
Can't be reproduced without this specific Token. May be related to Discord itself. Starting the bot with a different token fixes the issue.

bot.on("guildDelete", guild => {
    LOG.info(`Got booted from a Server!!!!!!!!\n- Name: ${guild.name}\n- Member Count: ${guild.memberCount}\nI'm now in ${bot.guilds.cache.size} Servers!`);
    Utils.contactAdmins(`Got booted from a Server!!!!!!!!\n- Name: ${guild.name}\n- Member Count: ${guild.memberCount}\nI'm now in ${bot.guilds.cache.size} Servers!`);
})

Further details:

  • discord.js version: 12.4.1
  • Node.js version: 12.18.1
  • Operating system: Win10
  • Priority this issue should have – please be realistic and elaborate if possible: Low-Medium

Relevant client options:

  • partials: none
  • gateway intents: none
  • other: none
@Albert-J04
Copy link

I am seeing the same running on Ubuntu 18.04

@almostSouji
Copy link
Member

almostSouji commented Feb 24, 2021

12.4.1 is no longer supported, please check 12.5.1 for the same issue.
If you can reproduce it add a listener for the websocket event and provide the output:

bot.ws.on("GUILD_DELETE", console.log);

@MidSpike
Copy link
Contributor

MidSpike commented Feb 25, 2021

Can reproduce on 12.5.1

Output that @almostSouji requested:

{ id: 'censored_guild_id' } 0

Good thing that I keep track of guild add / removes!

The guild in question actually removed my bot around 2021-02-24...

However every time that I start my bot, that guild will have a GuildDelete trigger for it immediately upon the bot starting.

@almostSouji
Copy link
Member

I actually did not expect that to log anything. Since that's the case this behavior is coming directly from Discord and there is nothing we can do about it. Discord devs are aware but currently unsure about why it happens.

@Natemo2625
Copy link

If you want to prevent it from, say sending the set message on guildDelete like I have, you could add something like

if (guild.name === undefined) return;

@Ortovoxx
Copy link
Contributor

Ortovoxx commented Mar 3, 2021

I also get the same error. This should be fixed with #5367

Good thing that I keep track of guild add / removes!
The guild in question actually removed my bot around 2021-02-24...

This also happened to me. The guild which triggered it was removed about a week ago.

@almostSouji almostSouji reopened this Mar 9, 2021
@almostSouji
Copy link
Member

Reopening, apparently this is something we need to handle (they should however not be considered unavailable)

From the discord developers server:

[...], it may be related to soft-deleted guilds .. essentially we now may delete a guild without triggering a full deletion, and attempts to join the guild (on session start) may result in this being spammed to gateway. this event can be safely ignored

@Ortovoxx
Copy link
Contributor

This is handled in #5367

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants