Open Sodynoizz opened 2 years ago
discord.Emoji
is not a valid option type.
Can you try using only discord.Emoji
, this should use the converter
Can you try using only
discord.Emoji
, this should use the converter
Code that I tested
@discord.commands.slash_command(name="test")
async def emoji(self, ctx: discord.ApplicationContext, emoji : discord.Emoji):
await ctx.respond(emoji.name)
I got this error
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: TypeError: EmojiConverter.convert() missing 1 required positional argument: 'argument'
This should be fixed in the latest release
This should be fixed in the latest release
Well, I tested that code in py-cord version 2.1.1 with 1️⃣ emoji but it raised this error
discord.ext.commands.errors.EmojiNotFound: Emoji "1️⃣" not found.
This should be fixed in the latest release
Well, I tested that code in py-cord version 2.1.1 with 1️⃣ emoji but it raised this error
discord.ext.commands.errors.EmojiNotFound: Emoji "1️⃣" not found.
Try with a custom emoji, 1️⃣ is technically only a unicode character and not considered an emoji by the parser.
Hi, I have related but not the same problem with Emojis.
I made dropdown menu that user can customize with commands. I didn't found any proper way to pass unicode emoji through command. But why would I need a unicode emoji, you might ask? Because discord.SelectOption
doesn't like standard discord emoji format (e.g. :bulb
), it works with unicode just fine. It also has no problem with cusotm emojis for some reason.
Error message that i get:
Traceback (most recent call last):
File "/home/rafaln/.local/lib/python3.10/site-packages/discord/bot.py", line 1114, in invoke_application_command
await ctx.command.invoke(ctx)
File "/home/rafaln/.local/lib/python3.10/site-packages/discord/commands/core.py", line 375, in invoke
await injected(ctx)
File "/home/rafaln/.local/lib/python3.10/site-packages/discord/commands/core.py", line 132, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.components.0.components.0.options.0.emoji.name: Invalid emoji
I used this example and modified it a little bit:
options = [
discord.SelectOption(
label="Red", description="Your favourite colour is red", emoji=":smile:"
),
discord.SelectOption(
label="Green", description="Your favourite colour is green", emoji="⚗"
),
discord.SelectOption(
label="Blue", description="Your favourite colour is blue", emoji="<:troll:910540961958989934>"
),
Summary
The slash command didn't work when I add slash option which contains
Union[discord.Emoji, discord.PartialEmoji]
typeReproduction Steps
I tested code that has attribute type
Union[discord.Emoji, discord.PartialEmoji]
and this command didn't synced with guilds.Minimal Reproducible Code
Expected Results
I want the slash option support for
discord.Emoji
anddiscord.PartialEmoji
Actual Results
The command didn't synced with guilds.
Intents
intents = discord.Intents.all()
System Information
Checklist
Additional Context
No response