【问题标题】:Discord bot is not joining voice channelDiscord 机器人未加入语音频道
【发布时间】:2020-07-16 01:57:39
【问题描述】:
import discord
from discord.ext.commands import Bot
from discord.ext import commands,tasks
from discord.utils import get
from discord import Game

client = Bot(command_prefix = BOT_PREFIX)

@client.command()
async def join(ctx):
    channel = ctx.message.author.voice.channel
    voice = await channel.connect()
    await ctx.send('Joined {}'.format(channel))

我只是想做一个简单的方法,让我的不和谐机器人加入频道。我查看了多个线程,其中一些已经过时,因为它们在 discord.py 迁移到 v1.0 之前。我使用 type() 和 dir() 来检查通道是什么类型,并查看它有什么方法。我将它与 discord.py 中的 API 进行了比较,我发现一个问题是 dir() 创建了一个名为 connect 的字段,但 API 显示 channel 对象有一个名为 connect() 的方法。我目前正试图弄清楚如何让不和谐机器人加入,因为似乎connect() 方法不允许我连接,因为在我尝试使用connect() 后它不允许我继续使用该方法方法。感谢所有帮助! :)

【问题讨论】:

    标签: python discord discord.py


    【解决方案1】:

    channel = ctx.message.author.voice.channel 中删除邮件。 测试一下:)

    channel = ctx.author.voice.channel
    voice = await channel.connect()
    await ctx.send('Joined {}'.format(channel))
    

    【讨论】:

      猜你喜欢
      • 2021-04-24
      • 2022-01-04
      • 2023-02-25
      • 2022-01-23
      • 2021-01-05
      • 2020-09-05
      • 2020-11-04
      • 1970-01-01
      • 2021-07-13
      相关资源
      最近更新 更多