Игнорирует команду

Рейтинг: 1Ответов: 1Опубликовано: 04.03.2023

Игнорирует команду .test

@bot.command
async def test(ctx):
    channel = bot.get_channel(1038047770491244615)

    embed = disnake.Embed(
    title="test",
    description=f"test",
    color=0xff0000
    )
    embed.set_image(url = 'https://cdn.discordapp.com/attachments/1064997393218666506/1067142380244975696/image.png')

    await channel.send(embed=embed)
    await ctx.message.delete()

Скриншот

Ответы

▲ 0

У Вас некоректно указан декоратор. Измените @bot.command на @bot.command().

Если этого будет недостаточно, можете попробовать реализовать следующим образом:

...
bot = commands.Bot(command_prefix='.')
...

@bot.command()
async def test(ctx):
    channel = bot.get_channel(1038047770491244615)

    embed = disnake.Embed(
        title="test",
        description="test",
        color=0xff0000
    )
    embed.set_image(url='https://cdn.discordapp.com/attachments/1064997393218666506/1067142380244975696/image.png')

    await channel.send(embed=embed)
    await ctx.message.delete()

...

Или таким:

...
@bot.command()
async def test(ctx):
    if ctx.prefix == '.':
        channel = bot.get_channel(1038047770491244615)

        embed = disnake.Embed(
            title="test",
            description="test",
            color=0xff0000
        )
        embed.set_image(url='https://cdn.discordapp.com/attachments/1064997393218666506/1067142380244975696/image.png')

        await channel.send(embed=embed)
        await ctx.message.delete()
    else:
        await bot.process_commands(ctx.message)
...