custom_prefixes = {}
#You'd need to have some sort of persistance here,
#possibly using the json module to save and load
#or a database
default_prefixes = ['&']
async def determine_prefix(bot, message):
guild = message.guild
if guild:
return custom_prefixes.get(guild.id, default_prefixes)
else:
return default_prefixes
bot = commands.Bot(command_prefix = determine_prefix)
@bot.command()
@commands.has_permissions(administrator=True)
@commands.guild_only()
async def setprefix(ctx, *, prefixes=""):
custom_prefixes[ctx.guild.id] = prefixes.split() or default_prefixes
await ctx.send(f"Prefixes set to `{prefixes}` ")