将我的 Bot 部署到 Heroku 时如何解决 TypeError?

时间:2021-05-24 06:45:45

标签: python heroku discord discord.py

我尝试创建一个播放音乐的机器人。将其部署到 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}")

1 个答案:

答案 0 :(得分:0)

如果您要部署 Music Discord Bot,尤其是在使用 FFMPEG 时,Heroku 不是最佳主机。虽然有一种方法,但需要大量的工作来实施。我建议使用 Vultr 等 VPN,如果您不想玩,可以使用 PenguinBots 或 ShockNodes。

相关问题