【问题标题】:Discord bot not connectingDiscord 机器人无法连接
【发布时间】:2021-02-19 05:36:39
【问题描述】:

有人知道为什么我的机器人没有连接到我的不和谐语音频道吗?

import discord
import youtube_dl
from discord.ext import commands
import asyncio


@client.command()
async def join(ctx):

        channel = ctx.author.voice.channel
        await channel.connect

【问题讨论】:

  • await channel.connect() 不是await channel.connect
  • 谢谢,但还是不行。

标签: python discord discord.py ctx


【解决方案1】:
import discord

bot = commands.Bot(command_prefix="-")

@bot.command(pass_context=True)
async def join(ctx):

    vc = ctx.author.voice
    if vc:
        await vc.channel.connect()

这应该可行。

【讨论】:

    猜你喜欢
    • 2020-12-08
    • 2021-04-21
    • 2021-08-24
    • 2022-01-23
    • 1970-01-01
    • 2020-09-23
    • 2020-12-27
    • 2019-03-28
    • 2018-07-22
    相关资源
    最近更新 更多