Bug: on_guild_remove Randomly Called on Start
See original GitHub issueSummary
The on_guild_remove(guild)
event is called randomly on start.
Reproduction Steps
- Create a bot instance
- Have an
on_guild_remove(guild)
function with some type of logging - Start the bot
- Observe how the latest guilds are
Minimal Reproducible Code
import discord
from discord.ext import commands
class DiscordBot(commands.Bot):
def __init__(self):
intents = discord.Intents.default()
super().__init__(intents=intents, command_prefix="!")
async def on_guild_remove(self, guild: discord.Guild):
print(f"[GUILD REMOVE] Name: {guild.name} | ID: {guild.id} | Object type: {type(guild)}")
bot = DiscordBot()
bot.run("YOUR_TOKEN")
Expected Results
The event is not called unless the bot is removed from a guild.
Actual Results
The event is called with the most recent guild changes at start.
Intents
default
System Information
- Python v3.9.13-final
- discord.py v2.0.0-final
- aiohttp v3.8.1
- system info: Windows 10 10.0.19044 (Also happens in ubuntu)
Checklist
- I have searched the open issues for duplicates.
- I have shown the entire traceback, if possible.
- I have removed my token from display, if visible.
Additional Context
ItsWilliboy#1337 can reproduce this bug, as per: https://canary.discord.com/channels/336642139381301249/1009882344578097214/1009902388196421662
Image of logging (INFO):
Issue Analytics
- State:
- Created a year ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
python sequential bugs when call function more than one time
In my fonction i secure copy with def copyDict(d): r = dict()# no ref for y in d: r[y]=d[y][:] #[:] no ref return...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This happens when you’re in a guild TnS has soft-deleted.
Alright, thank you