async def faction_name_set(self, ctx, new_name): new_name = re.sub("[^\S ]+", "", new_name) if not (6 <= len(new_name) <= 32): raise BadArgumentErrorWithMessage(ctx.s("faction.err.name_length")) if sql.guild_get_by_faction_name(new_name): await ctx.send(ctx.s("faction.name_already_exists")) return sql.guild_faction_set(ctx.guild.id, name=new_name) await ctx.send(ctx.s("faction.set_name").format(new_name))
async def assemble(self, ctx, name, alias=""): if sql.guild_is_faction(ctx.guild.id): await ctx.send(ctx.s("faction.already_faction")) return name = re.sub("[^\S ]+", "", name) if not (6 <= len(name) <= 32): raise BadArgumentErrorWithMessage(ctx.s("faction.err.name_length")) if sql.guild_get_by_faction_name(name): await ctx.send(ctx.s("faction.name_already_exists")) return alias = re.sub("[^A-Za-z]+", "", alias).lower() if alias and not (1 <= len(alias) <= 5): raise BadArgumentErrorWithMessage(ctx.s("faction.err.alias_length")) if sql.guild_get_by_faction_alias(alias): await ctx.send(ctx.s("faction.alias_already_exists")) return sql.guild_faction_set(ctx.guild.id, name=name, alias=alias) await ctx.send(ctx.s("faction.assembled").format(name))