Why can't i use regional indicator symbol letter emoji in discord.py?
Question:
When I try to use emoji like " " I get this error:
Command raised an exception: HTTPException: 400 Bad Request (error code: 10014): Unknown Emoji
Here is my code:
@commands.command(name="warcaby", aliases=["checkers"])
async def warcabycmd(self, ctx):
gracz1 = ctx.author
gracz2 = ctx.message.mentions[0]
plansza_start = """(board)"""
embed=discord.Embed(title=f'Grasz z {gracz2}. Ruch gracza {gracz1}!', description=plansza_start, color=ctx.author.color)
embed.add_field(name='Instrukcje', value='Wybierz pole, a wybrać pionek, a następnie wybierz, w którą stronę idziesz!')
msg = await ctx.send(content=None, embed=embed)
await msg.add_reaction(":regional_indicator_f:")
await msg.add_reaction(":regional_indicator_g:")
await msg.add_reaction(":regional_indicator_h:")
await msg.add_reaction("two")
await msg.add_reaction("three")
await msg.add_reaction("four")
await msg.add_reaction("five")
await msg.add_reaction("six")
await msg.add_reaction("seven")
await msg.add_reaction("eight")
Can you help me with that?
Answers:
The bot sees discord emojis as unicode symbols. The bot needs the symbol, not their name. It cannot react to a message if you tell it that the emoji is :smile:
. You need to tell it that the emoji is " ", or " " in etc for the letters.
You can get these on the pc, by adding a in front of the emoji. Have a look at the attached screenshots.
It does however not work for the numbers. The symbols to use is: ‘1️⃣’, ‘2️⃣’ etc.
One idea to get the emojis is to use print and copy emojis out of the terminal.
Do a simple command like and look at the output in the terminal for the emojis you give it. what the terminal prints is what you need to use in your code.
@commands.command()
async def emojiprint(ctx, *, emojis):
print(emojis)
Here is your code with a small change I made. I tested it seems to be working!
@commands.command(name="warcaby", aliases=["checkers"])
async def warcabycmd(self, ctx):
gracz1 = ctx.author
gracz2 = ctx.message.mentions[0]
plansza_start = """(board)"""
embed=discord.Embed(title=f'Grasz z {gracz2}. Ruch gracza {gracz1}!', description=plansza_start, color=ctx.author.color)
embed.add_field(name='Instrukcje', value='Wybierz pole, a wybrać pionek, a następnie wybierz, w którą stronę idziesz!')
msg = await ctx.send(content=None, embed=embed)
emoji_list = [' ', ' ', ' ', '2️⃣', '3️⃣', '4️⃣', '5️⃣', '6️⃣', '7️⃣', '8️⃣']
for i in emoji_list:
await msg.add_reaction(i)
Here’s a neat way of getting the regional indicators dynamically:
from unicodedata import lookup
...
indicators = ["a", "x", "z"]
for i in indicators:
await message.add_reaction(lookup("REGIONAL INDICATOR SYMBOL LETTER %s" % i))
When I try to use emoji like " " I get this error:
Command raised an exception: HTTPException: 400 Bad Request (error code: 10014): Unknown Emoji
Here is my code:
@commands.command(name="warcaby", aliases=["checkers"])
async def warcabycmd(self, ctx):
gracz1 = ctx.author
gracz2 = ctx.message.mentions[0]
plansza_start = """(board)"""
embed=discord.Embed(title=f'Grasz z {gracz2}. Ruch gracza {gracz1}!', description=plansza_start, color=ctx.author.color)
embed.add_field(name='Instrukcje', value='Wybierz pole, a wybrać pionek, a następnie wybierz, w którą stronę idziesz!')
msg = await ctx.send(content=None, embed=embed)
await msg.add_reaction(":regional_indicator_f:")
await msg.add_reaction(":regional_indicator_g:")
await msg.add_reaction(":regional_indicator_h:")
await msg.add_reaction("two")
await msg.add_reaction("three")
await msg.add_reaction("four")
await msg.add_reaction("five")
await msg.add_reaction("six")
await msg.add_reaction("seven")
await msg.add_reaction("eight")
Can you help me with that?
The bot sees discord emojis as unicode symbols. The bot needs the symbol, not their name. It cannot react to a message if you tell it that the emoji is :smile:
. You need to tell it that the emoji is " ", or " " in etc for the letters.
You can get these on the pc, by adding a in front of the emoji. Have a look at the attached screenshots.
It does however not work for the numbers. The symbols to use is: ‘1️⃣’, ‘2️⃣’ etc.
One idea to get the emojis is to use print and copy emojis out of the terminal.
Do a simple command like and look at the output in the terminal for the emojis you give it. what the terminal prints is what you need to use in your code.
@commands.command()
async def emojiprint(ctx, *, emojis):
print(emojis)
Here is your code with a small change I made. I tested it seems to be working!
@commands.command(name="warcaby", aliases=["checkers"])
async def warcabycmd(self, ctx):
gracz1 = ctx.author
gracz2 = ctx.message.mentions[0]
plansza_start = """(board)"""
embed=discord.Embed(title=f'Grasz z {gracz2}. Ruch gracza {gracz1}!', description=plansza_start, color=ctx.author.color)
embed.add_field(name='Instrukcje', value='Wybierz pole, a wybrać pionek, a następnie wybierz, w którą stronę idziesz!')
msg = await ctx.send(content=None, embed=embed)
emoji_list = [' ', ' ', ' ', '2️⃣', '3️⃣', '4️⃣', '5️⃣', '6️⃣', '7️⃣', '8️⃣']
for i in emoji_list:
await msg.add_reaction(i)
Here’s a neat way of getting the regional indicators dynamically:
from unicodedata import lookup
...
indicators = ["a", "x", "z"]
for i in indicators:
await message.add_reaction(lookup("REGIONAL INDICATOR SYMBOL LETTER %s" % i))