Reputation: 9
I'm using Hybrid Commands to use Prefixed Commands and Application Commands simultaneously within one file. Obviously, the code that worked well until a few months ago now does not work, but strangely, only the commands that contain Embed in Application Commands do not work. Below is my code. Since I'm Korean, there are lots of Korean in code. Please understand.
# Load Libraries
import discord
from discord.ext import commands
from discord.commands import Option
import random
import asyncio
import time
import math
# Set Token token = '(token)'
# Setting Background Enviroment
intents = discord.Intents.all()
intents.message_content = True
bot = commands.Bot(command_prefix="시로야 ", intents=intents)
# If Bot is ready
#(Bot Ready Output)
#Prefixed Commands
#(No issue found in Prefixed Commands)
#Application Commands(Slash Commands)
#(There's a lot of Application Commands, but I just put a few commans that have issue)
@bot.slash_command(description="시로봇의 핑을 알려줘요!")
async def 핑(ctx):
ping = round((bot.latency) * 1000, 2)
embed = discord.Embed(title=":ping_pong: 퐁!", description=f"지연시간: {ping}ms", color=0xFFFFFF)
embed.set_footer(text="ShiroBot by. AndyKim")
await ctx.respond(embed=embed)
When I run the above code, the following error occurs;
Ignoring exception in command 핑
Traceback (most recent call last):
File "/home/user/diecord-bot-space/.venv/lib/python3.11/site-packages/discord/commands/core.py", line 131, in wrapped
ret = await coro(arg)
^^^^^^^^^^^^^
File "/home/user/discord-bot-space/.venv/lib/python3.11/site-packages/discord/commands/core.py", line 1013, in _ivoke
await self.callback(ctx, **kwargs)
File "/home/user/discord-bot-space/Shirobot.py", line 234, in 핑
embed = discord.Embed(title=":ping_pong: 퐁!", description=f"지연시간 : {ping}ms, color=0xFFFFFF")
^^^^^^^^^^^^
AttributeError: 'Command' objecthas no attribute 'Embed'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/user/discord-bot-space/.venv/lib/python3.11/site-packages/discord/bot.py", line 1130, in invoke_application_command
await ctx.command.invokee(ctx)
File "/home/user/discord-bot-space/.venv/lib/python3.11/site-packages/dsicord/command/core.py", line 376, in invoke
await injected(ctx)
File "/home/user/discord-bot-space/.venv/lib/python3.11/site-packages/discord/commands/core.py", line 139, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord,errors,ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'Command' object has no attribute 'Embed'
This error has not occurred since I first wrote this code. This error has occurred recently. Have there been any recent Embed-related changes in Py-cord? I would like to know what is causing this error. Thank you in advance for your kind explanation!
If you need more information, please let me know!
Upvotes: 0
Views: 56