在discord.py重写命令中找不到Discord Selfbot

时间:2020-10-12 08:37:31

标签: python-3.x discord discord.py-rewrite

我正在尝试在discord.py重写中为discord做一个selfbot,它给了我这个错误:

Ignoring exception in command None: discord.ext.commands.errors.CommandNotFound: Command "me" is not found

这是我的代码:

from discord.ext import commands

selfbot = commands.Bot(command_prefix = "<.", self_bot = True)

selfbot.event
async def on_ready():
    print(f'IDK Running on: {selfbot.user}')

selfbot.command()
async def test(ctx):
    await ctx.send('Off.')

selfbot.command()
async def me(ctx):
    ctx.send(f'You are {selfbot.user}')

token = 'token here'
selfbot.run(token, bot = False)```

1 个答案:

答案 0 :(得分:0)

您缺少@。应该是

from discord.ext import commands

selfbot = commands.Bot(command_prefix = "<.", self_bot = True)

@selfbot.event
async def on_ready():
    print(f'IDK Running on: {selfbot.user}')

@selfbot.command()
async def test(ctx):
    await ctx.send('Off.')

@selfbot.command()
async def me(ctx):
    ctx.send(f'You are {selfbot.user}')

token = 'token here'
selfbot.run(token, bot = False)

注意:您缺少命令装饰器的主要内容@,如果没有它,您的命令将不会注册为命令或事件