简体   繁体   English

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

[英]How can I solve a TypeError when deploying my Bot to Heroku?

I tried to create a bot that plays music.我试图创建一个播放音乐的机器人。 After deploying it to Heroku I get the following error :将其部署到 Heroku 后,出现以下错误

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: _hook() takes 2 positional arguments but 3 were given

I tried to host the bot from my computer and it works fine.我尝试从我的计算机托管机器人,它工作正常。 However it's not working when I am trying to host it on Heroku.但是,当我尝试在 Heroku 上托管它时,它不起作用。

Here is my code:这是我的代码:

@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}")

Heroku is not the best host if you are looking to deploy a Music Discord Bot, especially when you use FFMPEG.如果您要部署音乐 Discord 机器人,Heroku 不是最佳主机,尤其是在您使用 FFMPEG 时。 While there is a way, it takes a lot of work to implement.虽然有办法,但实施起来需要做很多工作。 I recommend using a VPN such as Vultr, if you don't want to play you can use PenguinBots, or ShockNodes.我建议使用 Vultr 等 VPN,如果您不想玩,可以使用 PenguinBots 或 ShockNodes。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何解决使用 Flask 在 Heroku 上部署模型后导致的应用程序错误? - How can i solve Application Error caused after deploying my model on Heroku using Flask? 为什么我的机器人出现错误? 我该如何解决? - Why is an error occurring in my bot? How can I solve it? 将机器人部署到 heroku,无法将机器人推送到 heroku - deploying bot to heroku, can't push bot to heroku 如何防止我的机器人在 Heroku 上入睡/闲置?,? 机器人开始轮询后 Cronjob 没有执行? - How can I prevent my bot to fall asleep/idiling on Heroku!?, Cronjob is not executing after bot starts polling? 将 Discord bot 部署到 heroku 时状态为 0 - Status 0 when deploying Discord bot to heroku 在 Heroku 上部署时电报机器人应用程序出现问题 - Issues with telegram bot app when deploying on Heroku 如何解决 heroku 上的应用程序错误? - How can I solve application error on heroku? 我该如何解决这个连接错误和类型错误 - how can i solve this connection error and typeerror 部署到 Heroku 时如何保护我的 API 令牌? - how to protect my token of API when deploying to Heroku? 使用 Heroku 进行部署时,如何克服“'django_content_type' 不存在”错误? - How can I get past this “'django_content_type' does not exist” error when deploying with Heroku?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM