【问题标题】:How can I fix this discord sound Bot error?如何解决此不和谐声音 Bot 错误?
【发布时间】:2021-02-05 08:34:41
【问题描述】:

嘿,我最近开始编码,现在我想做一个可以加入 Voice Chanel 的 Discord 机器人。当我执行此操作时:

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

@bot.commmands(pass_context=True, aliases=['j', 'joi'])
async def join (ctx):
    channel = ctx.message.author.voice.channel
    voicechannel = await channel.connect()

出现此错误后:

Traceback (most recent call last):
  File "C:\DEV\Python\Einführung\venv\lib\site-packages\discord\client.py", line 333, in _run_event
    await coro(*args, **kwargs)
  File "C:/DEV/Python/pythonProject1/venv/Discord Bot/Bot.py", line 23, in on_message
    @bot.commmands(pass_context=True, aliases=['j', 'joi'])
AttributeError: 'Bot' object has no attribute 'commmands'

【问题讨论】:

    标签: python discord bots args


    【解决方案1】:

    它的@bot.command() 不是@bot.commands。这里的情况下不能使用命令。

    也可以 channel = ctx.author.voice.channel 而不是 ctx.message.author.voice.channel 并且不需要为 await channel.connect() 传递变量。

    【讨论】:

    • 我做了更改,但仍然不起作用。现在出现此错误。 Traceback (most recent call last): File "C:/DEV/Python/pythonProject1/venv/Discord Bot/Bot.py", line 10, in <module> class myclient(discord.Client): File "C:/DEV/Python/pythonProject1/venv/Discord Bot/Bot.py", line 25, in myclient @bot.commmand(pass_context=True, aliases=['j', 'joi']) AttributeError: 'Bot' object has no attribute 'commmand'
    猜你喜欢
    • 2021-11-03
    • 1970-01-01
    • 2018-07-06
    • 1970-01-01
    • 2020-12-26
    • 2017-12-12
    • 2012-02-14
    • 2015-04-12
    • 2016-06-21
    相关资源
    最近更新 更多