0
votes

I'm trying to add two custom emojis to my bot's message. To add the custom emoji, I may have to buy discord nitro/prime to use it in other servers if I'm not mistaken. Is there any way to use my custom emojis without having to spend any money?

I was thinking if it was possible to read an image from my computer files and then turn it into a custom reaction for my bot to use. So far, I have no code because I don't really know how to work with Pillow and Image Editing in Python/Discord.py

2
I believe bot accounts can use emojis from any server/guild on any other server/guild. So you should be able to create your own server, add the emojis you want to use to that server and the bot will be able to use them on any server that it is connected to.Benjin
So I just have to give it the id of the emoji right? How do I get the emoji id?Daniel Tam
You can get all custom emojis the client can see using Client.emojis. If you still struggle, feel free to create another question or edit this one.Benjin

2 Answers

1
votes

You can use create_custom_emoji().

Usage:

server = discord.utils.get(client.guilds, id=123456789)  # your server's ID
with open("PATH TO YOUR IMAGE", "rb") as image:
    server.create_custom_emoji(name="EMOJI NAME", image=image)

Here's the page in the docs: https://discordpy.readthedocs.io/en/latest/api.html?highlight=create_custom_emoji#discord.Guild.create_custom_emoji

0
votes

SOLUTION

I basically just have to get the id of an emoji and then the name of it. You get the id by copying the link of the reaction you want. Just right click on it and copy link. After copying the link, paste it into your browser, you should see your emoji pop up into your browser.

For example, this link https://cdn.discordapp.com/emojis/755076996945543208.png?v=1. I just need to copy the numbers, which are 755076996945543208.

After getting the id, we need to get the emoji name. Which is pretty easy, I'm sure everybody knows how to do that.

After getting the emoji name and id all you have to do is this.

@client.command()
async def poll(ctx, *, message):
    msg = await ctx.send(f"**{message}**")
    await msg.add_reaction(emoji="name_of_emoji:emoji_id")

Thanks to everybody who participated and contributed to this question, I appreciate your help. :D