admin.py 文件源码

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

项目:GAFBot 作者: DiNitride 项目源码 文件源码
def leave(self, ctx, guild=None):
        """
        Leaves a specified guild
        """
        guild_names = list("{} - ID: {}".format(g.name, g.id) for g in self.bot.guilds)
        if guild is None:
            guild = await reaction_menu.start_reaction_menu(
                self.bot, guild_names, ctx.author, ctx.channel, count=1,
                timeout=60, per_page=10, header=header, return_from=self.bot.guilds, allow_none=True)
            guild = guild[0]
        else:
            guild = discord.utils.find(lambda s: s.name == guild or str(s.id) == guild, self.bot.guilds)
            if guild is None:
                await ctx.send("Unable to locate guild")
                return
        try:
            await guild.leave()
            await ctx.send("`Successfully left the guild`")
        except discord.HTTPException:
            await ctx.send("`Leaving the guild failed!`")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号