My code:
emoji = client.get_emoji(id=773100346749878293)
activity = discord.CustomActivity(name="DMs", type=discord.ActivityType.watching, emoji=emoji.)
await bot.change_presence(status=discord.Status.online, activity=activity)
So when I run it, an error throw out:
animated=data.get('animated', False),
AttributeError: 'Emoji' object has no attribute 'get'
Entire Function:
@tasks.loop(seconds=10)
async def change_presence():
await client.wait_until_ready()
emoji = client.get_emoji(773100346749878293)
activity = discord.CustomActivity(name="DMs", type=discord.ActivityType.watching, emoji=emoji)
await bot.change_presence(status=discord.Status.online, activity=activity)
Any ways to fix this or this is an error from the Library?
Well, this seems to be because discord.py
is not expecting an emoji
object in the initialization of a CustomActivity
, instead it is expecting you to pass a dictionary containing that emoji. You will need to pass a dictionary to not get that error.
On another topic, a bot is not allowed to have a CustomActivity, this is something internally managed by Discord so we cannot do anything about it. Only users can set custom activities, so if your code belongs to a bot it will not work despite solving the error.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments