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

Interaction Error on Shard Reconnection #2426

Closed
3 tasks done
MrMetacomCode opened this issue Apr 21, 2024 · 4 comments
Closed
3 tasks done

Interaction Error on Shard Reconnection #2426

MrMetacomCode opened this issue Apr 21, 2024 · 4 comments
Labels
bug Something isn't working priority: high High Priority

Comments

@MrMetacomCode
Copy link

MrMetacomCode commented Apr 21, 2024

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

@MrMetacomCode MrMetacomCode added the unconfirmed bug A bug report that needs triaging label Apr 21, 2024
@JustaSqu1d JustaSqu1d added bug Something isn't working priority: high High Priority and removed unconfirmed bug A bug report that needs triaging labels Apr 21, 2024
@plun1331
Copy link
Member

This was already fixed in #2411

@MrMetacomCode
Copy link
Author

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.

@plun1331
Copy link
Member

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)

@MrMetacomCode
Copy link
Author

Understood. It's in a docker compose container though so it did update when I used docker compose up -d --build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: high High Priority
Projects
None yet
Development

No branches or pull requests

3 participants