default_regions.py 文件源码

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

项目:BlitzcrankBotV2 作者: SuperFrosty 项目源码 文件源码
def set(self, ctx, region: str):
        """Set your server's default region"""
        try:
            Summoner(name="", region=region)
        except ValueError:
            embed = discord.Embed(
                title="Error!",
                description="{0} is not a valid region!".format(region),
                colour=0xCA0147)
            utils.footer(ctx, embed)
            await ctx.send("", embed=embed)
            return
        db = database.Database('guilds.db')
        try:
            region_found = db.find_entry(ctx.guild.id)
            db.close_connection()
            embed = discord.Embed(
                title="Error!",
                description="{0} is already {1}'s default region!".format(
                    region_found, ctx.guild.name),
                colour=0xCA0147)
            utils.footer(ctx, embed)
            await ctx.send("", embed=embed)
        except TypeError:
            db.add_entry(ctx.guild.id, region)
            db.close_connection()
            embed = discord.Embed(
                title="Success!",
                description="{0} set as {1}'s default region!".format(
                    region, ctx.guild.name),
                colour=0x1AFFA7)
            utils.footer(ctx, embed)
            await ctx.send("", embed=embed)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号