Discord Custom Activity Attribute Error, emoji object doesn't have attribute 'get'

Ricardolcm

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?

Shunya

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.

Source code

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.

Reference issue

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

throw error when attribute is accessed but doesn't exist in object

From Dev

Check if element doesn't have attribute jQuery

From Dev

target entity doesn't have attribute

From Dev

AttributeError: "QuerySet" doesn't have attribute 'model'

From Dev

How to get jquery object by its custom attribute

From Dev

class attribute doesn't get assigned correctly

From Dev

django 'User' object has no attribute 'get' error

From Dev

'function' object has no attribute 'get' error in django

From Dev

'function' object has no attribute 'get' error in django

From Dev

Set a custom object attribute

From Dev

Get a custom attribute with jQuery

From Dev

Get custom attribute value

From Dev

Get custom attribute woocommerce

From Dev

Get a custom attribute with jQuery

From Dev

Get custom attribute value

From Dev

How can I select the item that doesn't have attribute

From Dev

Select inputs that doesn't have value attribute with querySelector

From Dev

Element LinearLayout doesn't have required attribute layout_height

From Dev

g:form doesn't seem to have a "controller" attribute

From Dev

How can I select the item that doesn't have attribute

From Dev

accessing a <p> in Watir, which doesn't have attribute

From Dev

Abstract Django model doesn't have a "model" attribute?

From Dev

Why doesn't Dask dataframe have a shape attribute?

From Dev

Why is it a syntax error to have an object attribute named "del", "return" etc?

From Dev

Object have no attribute env error in odoo while executing a query

From Dev

Get instanced object by attribute

From Dev

JSON: Get object by attribute

From Dev

Cannot get attribute of an object

From Dev

JSON: Get object by attribute

Related Related

HotTag

Archive