예제 #1
0
    async def transac(self, ctx, amount: int, *members: UserList):
        '''Give or take percs from users'''
        db = ctx.bot
        members = [m for s in members for m in s]
        members = list(set(members))
        success = []
        not_enough = []
        
        for member in members:
            if member.id in db.people:
                if -1*amount > db.people[member.id]['percs']:
                    not_enough.append(member.name)
                else:
                    ctx.bot.transac(member.id, amount)
                    success.append(member.name)
        
        if ctx.message.mention_everyone: name_str = 'Everyone'
        else: name_str = say_list(success, 'No one')
        
        if amount < 0: action = 'lost'
        else: action = 'gained'
        
        d = '{} {} {} perc{}.'.format(name_str, action, amount, '' if amount == 1 else 's')
        if not_enough: d += ' {} did not have enough percs.'.format(say_list(not_enough))

        await ctx.send(d)
예제 #2
0
 async def alias_remove(self, ctx, item: Item, *aliases: to_lower):
     '''Remove aliases from an item'''
     try:
         if not isinstance(item[1]['aliases'], set):
             item[1]['aliases'] = set(item[1]['aliases'])
     except KeyError:
         item[1]['aliases'] = set()
     item[1]['aliases'] -= set(aliases)
     await ctx.send('Removed aliases {} for {}'.format(say_list(aliases, default='nothing', before='`',after='`'), item[0]))
예제 #3
0
    async def remind(self, ctx, role: UserList, *, message: str):
        '''Send a DM reminder to a role, user, or whatever'''
        failed = []
        for user in role:
            try: await user.send('Reminder! {}'.format(message))
            except: failed.append(user.name)

        d = 'Reminder sent!'
        if failed: d += ' DM failed for {}.'.format(say_list(failed))
        await ctx.send(d, delete_after=10)
예제 #4
0
    async def whitelist(self, ctx, *users: UserList):
        '''Unblacklist users'''
        users = [m for s in users for m in s]
        users = list(set(users))

        success = []
        for user in users:
            if user.id in ctx.bot.blacklist:
                ctx.bot.blacklist.remove(user.id)
                success.append(user.name)

        await ctx.send('Whitelisted {}.'.format(say_list(success)))
예제 #5
0
 async def addtier(self, ctx, amount: int, *members: UserList):
     '''Sets tiers for users.'''
     success = []
     db = ctx.bot
     members = [m for s in members for m in s]
     members = list(set(members))
     for member in members:
         if member.id in db.people:
             db.people[member.id]['tier'] += amount
             success.append(member.name)
     
     if ctx.message.mention_everyone: name_str = 'Everyone'
     else: name_str = say_list(success, 'No one')
     
     await ctx.send('{} has had {} added to their their tier.'.format(name_str, amount))
예제 #6
0
    async def blacklist(self, ctx, *users: UserList):
        '''Blacklist users'''
        users = [m for s in users for m in s]
        users = list(set(users))

        if not users:
            users = []
            for id in ctx.bot.blacklist:
                user = ctx.bot.get_user(id)
                if user: users.append(user.name)
            if users: await ctx.send(', '.join(users))
            else: await ctx.send('No one is blacklisted')
        else:
            success = []
            for user in users:
                if user.id not in ctx.bot.blacklist and user.id not in ctx.bot.config[
                        'owners']:
                    ctx.bot.blacklist.append(user.id)
                    success.append(user.name)

            await ctx.send('Blacklisted {}.'.format(say_list(success)))
예제 #7
0
 async def alias(self, ctx):
     '''View and edit aliases for items'''
     await ctx.send('Valid subcommands: {}'.format(
         say_list([c.name for c in ctx.command.commands], default='none', before='`', after='`')))
예제 #8
0
 async def alias_list(self, ctx, *, item: Item):
     '''List all aliases for an item'''
     if 'aliases' not in item[1]: item[1]['aliases'] = set()
     await ctx.send('Aliases for {}: {}'.format(item[0].title(), 
             say_list(list(item[1]['aliases']), default='none', before='`', after='`')
         ))