小编Kay*_*aya的帖子

Discord.py - 'VoiceState' 对象没有属性 'voice_channel'

每个人。我正在编写一个 Discord 机器人,用于播放声音。但我面临一个问题。

    channel = ctx.message.author.voice.voice_channel
AttributeError: 'VoiceState' object has no attribute 'voice_channel'

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'VoiceState' object has no attribute 'voice_channel
Run Code Online (Sandbox Code Playgroud)

这里有人可以帮我吗?感谢您提出任何意见。

功能:

import asyncio
import discord, time
from discord.ext import commands
from discord.voice_client import VoiceClient

@bot.command(pass_context=True)
async def bb(ctx):
    user = ctx.message.author
    channel = ctx.message.author.voice.voice_channel
    await bot.join_voice_channel(channel)
    player = voice.create_ffmpeg_player('1.m4a')
    player.start()
Run Code Online (Sandbox Code Playgroud)

python discord.py

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

discord.py ×1

python ×1