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

MessageToDict TypeError on changing presence #740

Open
4 tasks done
hydroxideee opened this issue Sep 29, 2024 · 2 comments
Open
4 tasks done

MessageToDict TypeError on changing presence #740

hydroxideee opened this issue Sep 29, 2024 · 2 comments
Labels
unconfirmed bug Unconfirmed bug

Comments

@hydroxideee
Copy link

Summary

When changing presence to idle TypeError is raised

Reproduction Steps

Call Client.change_presence with status set to idle and afk=True

Code

afk = selfclient.is_afk()
if not afk:
    await selfclient.change_presence(status=selfcord.Status.idle,
                                     afk=True,
                                     idle_since=selfbot_start_datetime,
                                     edit_settings=False)

Expected Results

Presence should change with no error and push notifications should start to be received.

Actual Results

Traceback (most recent call last):
  File "/home/container/main.py", line 557, in keep_afk
    await selfclient.change_presence(status=selfcord.Status.idle,
  File "/home/container/.local/lib/python3.11/site-packages/selfcord/client.py", line 1797, in change_presence
    await self.settings.edit(**payload)
  File "/home/container/.local/lib/python3.11/site-packages/selfcord/settings.py", line 1108, in edit
    existing = self.to_dict()
               ^^^^^^^^^^^^^^
  File "/home/container/.local/lib/python3.11/site-packages/selfcord/settings.py", line 154, in to_dict
    return MessageToDict(
           ^^^^^^^^^^^^^^
TypeError: MessageToDict() got an unexpected keyword argument 'always_print_fields_with_no_presence'

Presence appears to change to idle even with the error being raised, but no push notifications are received this way.

System Information

- Python v3.11.10-final
- selfcord.py v2.1.0-alpha
    - selfcord.py metadata: v2.1.0a4415+gbffa263e
- aiohttp v3.9.1
- system info: Linux 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01)

Checklist

  • I have confirmed I am using unmodified discord.py-self and not the upstream discord.py.
  • I have searched the open issues for duplicates.
  • I have shared the entire traceback.
  • I am using a user token (and it isn't visible in the code).

Additional Information

Might be similar to #729 but downgrading the protobuf library to the 4.25.4 or lower did not fix the issue

@hydroxideee hydroxideee added the unconfirmed bug Unconfirmed bug label Sep 29, 2024
@Ulysse2211
Copy link

Confirming I'm having this issue too:
This code (from the documentation):

async def on_ready():    
    game = discord.Game("with the Python")

throws this error:

2024-10-10 09:27:15 ERROR    discord.client Ignoring exception in on_ready
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/discord/client.py", line 507, in _run_event
    await coro(*args, **kwargs)
  File "/workspace/selfbot-unocorp/selfbot.py", line 223, in on_ready
    await client.change_presence(activity=game)
  File "/usr/local/lib/python3.12/dist-packages/discord/client.py", line 1567, in change_presence
    await self.settings.edit(**payload)
  File "/usr/local/lib/python3.12/dist-packages/discord/settings.py", line 1100, in edit
    existing = self.to_dict()
               ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/discord/settings.py", line 146, in to_dict
    return MessageToDict(
           ^^^^^^^^^^^^^^
TypeError: MessageToDict() got an unexpected keyword argument 'including_default_value_fields'

i'm gonna try to downgrade protobuf to see if it works. I'm letting you know.

@Ulysse2211
Copy link

@hydroxideee, downgrading to protobuf 4.25.0 solved the issue form me. You could try to do the same, I did it in a venv, but didn't try protobuf version 4.25.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unconfirmed bug Unconfirmed bug
Projects
None yet
Development

No branches or pull requests

2 participants