Пример #1
0
async def prefixes_for(guild):
    _guild = Guild.find_one({'guild_id': str(guild.id)})
    if not _guild:
        guild_template = {
            'guild_id': str(guild.id),
            'name': guild.name,
            'prefix': config.prefix
        }
        guild_id = Guild.insert_one(guild_template).inserted_id
        _guild = Guild.find_one({'guild_id': str(guild.id)})

    return _guild.prefix
Пример #2
0
    async def prefix(self, ctx):
        """ View the bot prefix """
        guild = Guild.find_one({'guild_id': str(ctx.guild.id)})
        prefix = self.config.prefix
        if guild:
            prefix = guild['prefix']

        await ctx.send(f"```diff\nPrefix: { prefix }```")
Пример #3
0
 async def setprefix(self, ctx, prefix: str = None):
     """ Set a custom prefix for your server """
     if prefix is None:
         return await ctx.send_help('setprefix')
     guild = Guild.find_one({'guild_id': str(ctx.guild.id)})
     guild['prefix'] = prefix[:5]
     Guild.save(guild)
     print(guild)