【问题标题】:Discord Selfbot in discord.py rewrite command not found未找到 discord.py 重写命令中的 Discord Selfbot
【发布时间】:2021-01-26 13:27:19
【问题描述】:

我正在尝试在 discord.py rewrite 中为 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)```

【问题讨论】:

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


    【解决方案1】:

    你错过了@。应该是的

    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)
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-19
      • 2021-07-15
      • 2021-08-07
      • 2020-05-03
      • 2020-11-06
      • 2021-03-30
      • 2020-09-11
      • 1970-01-01
      相关资源
      最近更新 更多