【问题标题】:Discord Bot Join Voice ChannelDiscord Bot 加入语音频道
【发布时间】:2020-11-04 05:28:13
【问题描述】:

我希望我的 Discord 机器人加入语音频道,但我遇到了一个问题,即每当我希望它加入 VC 时,什么都没有发生 - 甚至没有错误。我已经尝试过 SO/Git 的其他解决方案,但没有一个对我有用(下面是其中之一):

client = commands.Bot(command_prefix=get_prefix)
@client.command()
async def join(ctx):
    channel = ctx.author.voice.channel
    await channel.connect()

【问题讨论】:

    标签: python discord bots


    【解决方案1】:

    我知道你已经解决了你的问题,但我会告诉你我是如何解决它的,尤其是如果你曾经使用过@client.event

    我不确定这是否可行,但请尝试一下。 首先,我进入我的终端并使用pip install PyNaCl。 然后我用await ctx.author.voice.channel.connect()

    从那里,您可以播放您的音频文件。虽然首先,我会安装 ffmpeg 以防万一。请记住这一点,但无论如何,恭喜您找到解决方案!

    【讨论】:

      【解决方案2】:

      你忘记了什么。

      第 4 行需要

      channel = client.get_channel(ctx.author.voice.channel.id)
      await channel.connect()
      

      【讨论】:

        猜你喜欢
        • 2020-11-03
        • 1970-01-01
        • 2022-01-23
        • 2021-01-05
        • 2020-06-26
        • 2017-06-22
        • 2020-12-21
        • 1970-01-01
        • 2020-10-07
        相关资源
        最近更新 更多