admin.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:MangoByte 作者: mdiller 项目源码 文件源码
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`")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号