0
votes

I'm using Discord.py to make a bot and I'm looking for a way to return a random emoji when a command is called. I'm not really sure how to return a random emoji from Discord's emojis. According to the documentation, it that bot.emojis returns a list of emojis that the connected client has, but when I use it, I just get an empty list. I'm assuming that refers to custom emojis. I want to make it so that the command returns a list of random emojis. I suppose I can get the unicodes as a list / json file and work off that, but I was wondering if there is a better way? Both of the things I've tried so far have yielded no luck.

@bot.command()
async def foo(ctx): # Not working right now.
    # print(ctx.guild.emojis)
    print(bot.emojis)

Thank you.

1
You could use the python emoji library which let you use the unicode consortium emojis.DaveStSomeWhere

1 Answers

0
votes

You're correct, bot.emojis does return a list of custom emojis in the context of the guild.

There are no references to Unicode emojis in Discord's API, unfortunately, the only way to do this is to store the emojis externally.