Discord Bot加入语音频道

时间:2020-07-14 19:25:50

标签: python discord bots

我希望我的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()

编辑:已解决!问题是:未安装discord.py [voice]模块。解: pip install -U discord.py[voice]

1 个答案:

答案 0 :(得分:1)

你忘记了什么。

第 4 行需要

const records = [1612271438035, 1612271489789, 1612271498250, 1612271498756, 1612271499731, 1612271507831, 1612271508337, 1612271509048, 1612271511891, 1612271511895, 1612271512084, 1612271519936, 1612271520438, 1612271521713, 1612271525260, 1612271525264, 1612271527431, 1612271544137, 1612271544640, 1612271546389, 1612271551144, 1612271551646, 1612271553157, 1612271553163, 1612271557885, 1612271558028, 1612271558032, 1612271559399, 1612271559402, 1612271564461, 1612271564566, 1612271564570, 1612271564572, 1612271564577, 1612271567860, 1612271567863, 1612271568180, 1612271573603, 1612271573607, 1612271601243, 1612271601355, 1612271603883, 1612271604061, 1612271608817, 1612271608930, 1612271612965, 1612271613999];

function timeInteraction(timeArray) {
      let newArray = [];
      for (let i = 1; i < timeArray.length; i++) {
        newArray.push(timeArray[i] - timeArray[i-1]);
      }
      return newArray;
}

console.log(timeInteraction(records));