Interaction Error on Shard Reconnection
MrMetacomCode opened this issue · 4 comments
Summary
This interaction error is thrown after a shard reconnection and the bot starts back up again. The only part of my code in this error is the "bot.run(TOKEN)". This didn't happen every time but did crash the bot's startup process.
Traceback (most recent call last):
File "/app/main.py", line 263, in <module>
bot.run(TOKEN)
File "/usr/local/lib/python3.10/site-packages/discord/client.py", line 766, in run
return future.result()
File "/usr/local/lib/python3.10/site-packages/discord/client.py", line 745, in runner
await self.start(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/discord/client.py", line 709, in start
await self.connect(reconnect=reconnect)
File "/usr/local/lib/python3.10/site-packages/discord/shard.py", line 475, in connect
raise item.error
File "/usr/local/lib/python3.10/site-packages/discord/shard.py", line 180, in worker
await self.ws.poll_event()
File "/usr/local/lib/python3.10/site-packages/discord/gateway.py", line 603, in poll_event
await self.received_message(msg.data)
File "/usr/local/lib/python3.10/site-packages/discord/gateway.py", line 555, in received_message
func(data)
File "/usr/local/lib/python3.10/site-packages/discord/state.py", line 818, in parse_interaction_create
interaction = Interaction(data=data, state=self)
File "/usr/local/lib/python3.10/site-packages/discord/interactions.py", line 171, in __init__
self._from_data(data)
File "/usr/local/lib/python3.10/site-packages/discord/interactions.py", line 201, in _from_data
self._guild = Guild(data=self._guild_data, state=self)
File "/usr/local/lib/python3.10/site-packages/discord/guild.py", line 307, in __init__
self._from_data(data)
File "/usr/local/lib/python3.10/site-packages/discord/guild.py", line 515, in _from_data
cache_joined = self._state.member_cache_flags.joined
AttributeError: 'Interaction' object has no attribute 'member_cache_flags'
Reproduction Steps
The bot was running and this happened after a shard re-connection.
Minimal Reproducible Code
import discord
from discord import Intents
from discord.ext import commands
intents = Intents(guild_messages=True, guilds=True, voice_states=True, messages=True, message_content=True, members=True,
reactions=True, auto_moderation_execution=True)
bot = commands.AutoShardedBot(intents=intents)
TOKEN = 123456
bot.run(TOKEN)
Expected Results
Not to get this error and have the bot run smoothly like it had previously.
Actual Results
The bot crashed.
Intents
Shown in minimum reproducible code answer.
System Information
Docker Compose Container on Ubuntu Server
Python 3.10
Pip Packages:
APScheduler==3.9.1
git+https://github.com/Pycord-Development/pycord.git
GitPython==3.1.42
PyYAML==6.0.1
python-dateutil==2.8.2
aiohttp==3.9.3
rsa==4.9
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
No response
That is from 3 weeks ago and I restarted my bot in the last 2 weeks meaning it would pull all the latest changes from master and should have been running with the "fix"? Unless for some reason it wasn't running with that PR.
That is from 3 weeks ago and I restarted my bot in the last 2 weeks meaning it would pull all the latest changes from master and should have been running with the "fix"? Unless for some reason it wasn't running with that PR.
Your traceback does not match what we currently have on master, and for the library to update you must update it manually (pip install -U -r requirements.txt
)
Understood. It's in a docker compose container though so it did update when I used docker compose up -d --build
.