def summon(self, ctx, channel : discord.VoiceChannel = None):
"""Summons the bot to the voice channel you are currently in
You can specify the specific voice channel that you would like to connect to. If no channel is specified, it will connect to whatever channel you are currently in.
**Example:**
`{cmdpfx}summon General`"""
if not channel:
if not ctx.message.author.voice:
raise UserError("You are not currently in a voice channel")
channel = ctx.message.author.voice.channel
if channel.guild != ctx.message.guild:
raise UserError("You are not currently in a voice channel on this server/guild")
audio = self.bot.get_cog("Audio")
if not audio:
raise UserError("You must have the Audio cog enabled to do this")
try:
await audio.connect_voice(channel)
botdata.guildinfo(channel.guild.id).voicechannel = channel.id
except asyncio.TimeoutError:
raise UserError("There was a timeout when attempting to do the `?summon`")
评论列表
文章目录