dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
665 stars 155 forks source link

Abnormal sessions replace causing crashes #525

Open BlueSchnabeltier opened 1 year ago

BlueSchnabeltier commented 1 year ago

Summary

After running commands a lot of times i get an error that says it's unable to get the session.

Reproduction Steps

Run commands a lot. A lot lot.

Code

async for command in thread.slash_commands(command_ids=[...]):
    await command(prompt=prompt)

Expected Results

It should execute the command.

Actual Results

It raises this error:

[2023-06-22 06:49:51] [ERROR   ] discord.app_commands.tree: Ignoring exception in command 'xxxxxxx'
Traceback (most recent call last):
  File "C:\Users\User\PycharmProjects\...\venv\lib\site-packages\discord\app_commands\commands.py", line 828, in _do_call
    return await self._callback(interaction, **params)  # type: ignore
  File "C:\Users\User\PycharmProjects\...\main.py", line 96, in xxxxxxx
    generation = await xxxxxxxxxxxxxxxxx.xxxxxxx(prompt, thread_id=thread.id)
  File "C:\Users\User\PycharmProjects\...\utils\midjourney.py", line 166, in xxxxxxx
    await client.start(self.__token)
  File "C:\Users\User\PycharmProjects\...\venv\lib\site-packages\selfcord\client.py", line 888, in start
    await self.connect(reconnect=reconnect)
  File "C:\Users\User\PycharmProjects\...\venv\lib\site-packages\selfcord\client.py", line 769, in connect
    await self.ws.poll_event()
  File "C:\Users\User\PycharmProjects\...\venv\lib\site-packages\selfcord\gateway.py", line 648, in poll_event
    await self.received_message(msg.data)
  File "C:\Users\User\PycharmProjects\...\venv\lib\site-packages\selfcord\gateway.py", line 598, in received_message
    func(data)
  File "C:\Users\User\PycharmProjects\...\venv\lib\site-packages\selfcord\state.py", line 1066, in parse_ready_supplemental
    self.parse_sessions_replace(data['sessions'], from_ready=True)
  File "C:\Users\User\PycharmProjects\...\venv\lib\site-packages\selfcord\state.py", line 1511, in parse_sessions_replace
    fake = data[self.session_id]  # type: ignore
KeyError: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' # <- This is the seesion id, I just didn't wanna show mine.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\User\PycharmProjects\...\venv\lib\site-packages\discord\app_commands\tree.py", line 1248, in _call
    await command._invoke_with_namespace(interaction, namespace)
  File "C:\Users\User\PycharmProjects\...\venv\lib\site-packages\discord\app_commands\commands.py", line 853, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
  File "C:\Users\User\PycharmProjects\...\venv\lib\site-packages\discord\app_commands\commands.py", line 846, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'xxxxxxx' raised an exception: KeyError: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' # <- This is the seesion id, I just didn't wanna show mine.

System Information

Checklist

Additional Information

No response

inas2000 commented 1 year ago

Me too

oliverisracing commented 1 year ago

Hey i’m getting this too

JRYT431 commented 1 year ago

Me too

itskekoff commented 1 year ago

lol wtf, i don't getting this error, maybe because i just finding slash command by query and executing it.

BlueSchnabeltier commented 1 year ago

i hope @dolfies will look into this

PixelSleuth commented 1 year ago

Me too

GrahamboJangles commented 1 year ago

Me too

BlueSchnabeltier commented 1 year ago

lol wtf, i don't getting this error, maybe because i just finding slash command by query and executing it.

that has literally nothing to do with it

dolfies commented 1 year ago

I'm unable to reproduce this. I'd appreciate someone sending full debug logs when this occurs.