【发布时间】:2021-08-12 12:01:38
【问题描述】:
我尝试创建一个播放音乐的机器人。将其部署到 Heroku 后,我收到以下 错误:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: _hook() takes 2 positional arguments but 3 were given
我尝试从我的计算机托管机器人,它运行良好。但是,当我尝试在 Heroku 上托管它时它不起作用。
这是我的代码:
@client.command(pass_context=True, aliases=['j', 'joi'])
async def join(ctx):
channel = ctx.message.author.voice.channel
voice = get(client.voice_clients, guild=ctx.guild)
if voice and voice.is_connected():
await voice.move_to(channel)
else:
voice = await channel.connect()
await voice.disconnect()
if voice and voice.is_connected():
await voice.move_to(channel)
else:
await channel.connect()
print(f"The bot has connected to {channel}\n")
await ctx.send(f"Joined {channel}")
【问题讨论】:
-
请分享代码!
-
该错误包含有关
_hook()的内容,但代码似乎没有此内容。您确定您与我们分享了正确的代码吗? -
是的,这就是代码,没有像 _hook() 这样的东西
标签: python heroku discord discord.py