async def get_prefix(_, message): guild_id = message.guild.id if PrefixHandler.has_custom_prefix(guild_id): guild_prefix = PrefixHandler.get_prefix(guild_id) if guild_prefix: return (*prefix_list, guild_prefix) else: return prefix_list
async def prefix(self, ctx): if ctx.invoked_subcommand is None: prefix = PrefixHandler.get_prefix(ctx.guild.id) embed = discord.Embed(title="Setting a custom prefix", color=0x467f05) if not prefix: prefix = PrefixHandler.get_default_prefix() embed.description = f'{help_message_set.format(prefix)}\n\n{help_message_remove.format(prefix)}' await ctx.send(embed=embed)
async def get_prefix(_, message): try: guild_id = message.guild.id except AttributeError: return prefix_list if PrefixHandler.has_custom_prefix(guild_id): guild_prefix = PrefixHandler.get_prefix(guild_id) if guild_prefix: return *prefix_list, guild_prefix else: return prefix_list
async def set(self,ctx,new_prefix): """ This command is used to set a custom prefix for your server It takes one argument and that is the prefix that you want to set 🔒 You will require **administrator** permissions to use this """ PrefixHandler.add_prefix(author=ctx.author, guild_id=ctx.guild.id, prefix=new_prefix) await ctx.send( f"✅ | the prefix for **{ctx.guild.name}** has been to set to {new_prefix}")
async def remove_(self, ctx): """ Used to remove a custom prefix of a server No args are required 🔒 You will require **administrator** permissions to use this """ if PrefixHandler.has_custom_prefix(ctx.guild.id): PrefixHandler.remove_prefix(guild_id=ctx.guild.id) await ctx.send( f"✅ | the prefix for **{ctx.guild.name}** has been removed") else: await ctx.send("Your server does not have a custom prefix to remove")
async def prefix(self,ctx): if ctx.invoked_subcommand is None: prefix = PrefixHandler.get_prefix(ctx.guild.id) embed = discord.Embed(title="Setting a custom prefix",color=0x467f05) if not prefix: prefix = get_prefix() embed.description = f"`{prefix}set <prefix>`"