[英]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.