Python 不一致语音信道链路

Python 不一致语音信道链路,python,discord,Python,Discord,我正在尝试制作一个机器人,如果你在一个语音频道中,你在广告频道中键入一个命令,它会在该广告频道中创建一个指向你的语音频道的链接,供人们点击,并将他们带入语音频道,这就是我到目前为止所做的 import discord from discord.ext import commands client = commands.Bot(command_prefix='$') @client.command() async def invite(ctx): link = await Vo

我正在尝试制作一个机器人,如果你在一个语音频道中,你在广告频道中键入一个命令,它会在该广告频道中创建一个指向你的语音频道的链接,供人们点击,并将他们带入语音频道,这就是我到目前为止所做的

import discord
from discord.ext import commands

client = commands.Bot(command_prefix='$')


@client.command()   
async def invite(ctx):
    link = await VoiceState.channel.invite(max_age = 300)
    await ctx.send("Here is an instant invite to your server: " + link)

there is this error discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'VoiceState' is not defined
我不知道如何获取其余代码,也不知道如何修复现有代码