@AngryyFrost

Discord.py команда не найдена, что не так?

Здравствуйте. В какой-то момент перестали работать все команды в боте.
При попытке написания любой команды, выходит ошибка, что команда не найдена.
Не могу найти ошибку в коде, помогите пожалуйста рахобраться.

import discord
from discord.ext import commands
from discord.ext.commands import Bot
from discord_components import DiscordComponents, Button, ButtonStyle

intents = discord.Intents.all()
intents.typing = True
intents.presences = True

Bot: Bot = commands.Bot(command_prefix='.', intents=intents)


@Bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandNotFound):
        await ctx.send(
            embed=discord.Embed(description=f'{ctx.author.name}, команда не найдена!', colour=discord.Color.blue()))


@Bot.event
async def on_ready():
    DiscordComponents(Bot)
    print("Pokrenut")


@Bot.event
async def on_message(message):
    await Bot.process_commands(message)
    print(message.content)


@Bot.event
async def on_member_join(autor):
    # channel = Bot.get_channel(685038866616680461)
    await autor.send(
        f"Привет <@!{autor.id}>, если ты решил вступить в клан Destiny 2, то в начале зайди в канал "
        f"<#693850258995937350>, "
        f"возьми роль Destiny 2, "
        f"звтем вернись сюда и перейди в канал <#685429738038231050> и оставь там свою заявку.)")

    @Bot.command()
    async def test(ctx):
        await ctx.send(
            embed=discord.Embed(title="Пригласить в канал"),
            components=[
                Button(style=ButtonStyle.green, label="Вступить", emoji=":white_check_mark:"),
                Button(style=ButtonStyle.red, label="Отказаться", emoji=":x:"),
                Button(style=ButtonStyle.blue, label="Я подумаю", emoji=":question:"),
                Button(style=ButtonStyle.URL, label="Канал", url="https://discord.gg/T3Rhg3xU"),
            ]
        )
        response = await Bot.wait_for("button_click")
        if response.channel == ctx.channel:
            if response.component.label == "Вступить":
                await response.respond(content="Пркрасно")
            else:
                await response.respond(
                    embed=discord.Embed(title="Ты точно уверен?"),
                    components=[
                        Button(style=ButtonStyle.green, label="Да"),
                        Button(style=ButtonStyle.red, label="Нет"),
                        Button(style=ButtonStyle.blue, label="Я подумаю"),
                    ]
                )

    @Bot.command()
    async def send_m(ctx, member: discord.Member):
        await member.send(f" Псс,{ctx.author.name}, сказал что {member.name} , хороший человек")

    @Bot.command()
    async def send_b(member: discord.Member):
        await member.send(
            f"Привет, {member} если ты решил вступить в клан Destiny 2, то в начале зайди в канал "
            f"<#693850258995937350> и возьми роль Destiny 2, звтем перейди в канал <#685429738038231050> и оставь там "
            f"свою заявку.)")

    @Bot.command()
    async def send_a(ctx):
        await ctx.autor.send("ку-ку")


Ошибка:
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "test" is not found
  • Вопрос задан
  • 243 просмотра
Решения вопроса 1
@Kadabrov
у вас все команды внутри функции
async def on_member_join(autor):
функции @Bot.command() должны быть на одном уровне с @Bot.event

Изучаем Python. Том 1
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы