I'm trying to set a custom activity and getting an error.
cs = discord.CustomActivity(name="Custom status lol :P", emoji=discord.PartialEmoji(name='馃'))
await self.client.change_presence(activity=cs)
The status will be set.
First try with PartialEmoji (as seen in the docs):
Traceback (most recent call last):
File "/Users/nemetharon/Desktop/FightMan01_bot/1.2.3/cogs/status.py", line 30, in on_status_ready
cs = discord.CustomActivity(name="Custom status lol :P", emoji=discord.PartialEmoji(name='馃'))
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/discord/activity.py", line 696, in __init__
self.emoji = PartialEmoji.from_dict(emoji)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/discord/partial_emoji.py", line 80, in from_dict
return cls(animated=data.get('animated', False), id=data.get('id'), name=data.get('name'))
AttributeError: 'PartialEmoji' object has no attribute 'get'
Second try with a simple string:
Traceback (most recent call last):
File "/Users/nemetharon/Desktop/FightMan01_bot/1.2.3/cogs/status.py", line 30, in on_status_ready
cs = discord.CustomActivity(name="Custom status lol :P", emoji='馃')
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/discord/activity.py", line 696, in __init__
self.emoji = PartialEmoji.from_dict(emoji)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/discord/partial_emoji.py", line 80, in from_dict
return cls(animated=data.get('animated', False), id=data.get('id'), name=data.get('name'))
AttributeError: 'str' object has no attribute 'get'
Bots can't have a custom statuses, but that said, this is either a documentation error or lib bug, as indeed, this doesn't work.
Indeed, this is a bug caused by this line. The documentation says that the emoji parameter receives an object of type PartialEmoji (as you did), but, in fact, it should receive a dict data to PartialEmoji.from_dict create the object itself.
Again, bots can't have a custom status, so you cannot run your code without having an error
Even though bots cannot have emojis in CustomActivity, the error he gets does not match the documentation.
Thank you for the reply!
I just tried it.
But I think the docs should be inform me about it.