Search code examples
animationdiscordemojidiscord.py

Making my Discord.py bot send an animated emoji


I have attempted this as my code.

@client.command()
async def party(ctx):
    party = client.get_emoji(786138532069900350)
    await ctx.send('{}'.format(party))

but it replies as None
It's an animated default discord emoji Emoji So what am I doing wrong?


Solution

  • I have noticed that your get_emoji variable name is party, the same as command (or function's) name, That's why it is returning None. Please change the variable name to something other then function's name. Example:

    @client.command()
    async def party(ctx):
        partyemoji = client.get_emoji(786138532069900350) # problem was here
        await ctx.send(partyemoji) # instead of formatting string simply use variable name.
    

    P.S: If it still returns None check if your emoji ID is valid or not.