async def factionlist(self, ctx, page: int = 1): fs = [ x for x in sql.guild_get_all_factions() if x.id not in sql.faction_hides_get_all(ctx.guild.id) ] if len(fs) > 0: pages = 1 + len(fs) // 10 page = min(max(page, 1), pages) g = sql.guild_get_prefix_by_id(ctx.guild.id) msg = [ "**{}** - {} {}/{}".format(ctx.s("faction.list_header"), ctx.s("bot.page"), page, pages), "```xl", "{0:<34} {1:<5}".format(ctx.s("bot.name"), ctx.s("bot.alias")) ] for f in fs[(page - 1) * 10:page * 10]: alias = '"{}"'.format( f.faction_alias) if f.faction_alias else "" msg.append("{0:<34} {1:<5}".format( '"{}"'.format(f.faction_name), alias)) msg.append("") msg.append("// " + ctx.s("faction.faction_list_footer_1").format(g)) msg.append("// " + ctx.s("faction.faction_list_footer_2").format(g)) msg.append("```") await ctx.send('\n'.join(msg)) else: await ctx.send(ctx.s("faction.no_factions"))
def get_prefix(bot_, msg: discord.Message): return [sql.guild_get_prefix_by_id(msg.guild.id), bot_.user.mention + " "] \ if msg.guild else [cfg.prefix, bot_.user.mention + " "]
def gprefix(self): return sql.guild_get_prefix_by_id(self.guild.id)