Ejemplo n.º 1
0
 def get(self):
     userList = User.all()
     for user in userList:
         d = call_api(id=user.internalName, api="LOL", ext="USER")
         if d is None:
             user.marked = True
             break
         user.internalName, user.displayName, user.iconID = d["data"]["internalName"], d["data"]["name"], d["data"]["icon"]
         user.put()
     get_user_list(update=True)
Ejemplo n.º 2
0
def record_welp(bot, trigger):
    # TODO: record winner at time of welp
    if bot.memory.contains('welpcall_active') and bot.memory['welpcall_active']:
        welp_list = bot.memory['welpcall_list']
        nick = trigger.nick
        if nick not in welp_list:
            welp_list.append(nick)
        
        if welp_list == utils.get_user_list(bot, '#testchannelpleaseignore'):
            _end_welpcall(bot)
Ejemplo n.º 3
0
def record_welp(bot, trigger):
    # TODO: record winner at time of welp
    if bot.memory.contains(
            'welpcall_active') and bot.memory['welpcall_active']:
        welp_list = bot.memory['welpcall_list']
        nick = trigger.nick
        if nick not in welp_list:
            welp_list.append(nick)

        if welp_list == utils.get_user_list(bot, '#testchannelpleaseignore'):
            _end_welpcall(bot)
Ejemplo n.º 4
0
def _end_welpcall(bot):
    bot.memory['welpcall_active'] = False
    users = utils.get_user_list(bot, '#testchannelpleaseignore')

    if len(bot.memory['welpcall_list']):
        winner = bot.memory['welpcall_list'][0]
        missed = set(users) - set(bot.memory['welpcall_list'])
    else:
        winner = None
        missed = users

    if '#testchannelpleaseignore' in bot.channels:
        bot.msg('#testchannelpleaseignore', 'welpcall complete.')
        bot.msg('#testchannelpleaseignore', 'Winner: ' + (winner or 'no one'))
        bot.msg('#testchannelpleaseignore', 'Failed to welp: ' + ', '.join(missed))

    if winner:
        win_count = bot.db.get_nick_value(winner, 'welpcall_wins') or 0
        bot.db.set_nick_value(winner, 'welpcall_wins', win_count + 1)
    if missed:
        for nick in missed:
            loss_count = bot.db.get_nick_value(nick, 'welpcall_misses') or 0
            bot.db.set_nick_value(nick, 'welpcall_misses', loss_count + 1)
Ejemplo n.º 5
0
def _end_welpcall(bot):
    bot.memory['welpcall_active'] = False
    users = utils.get_user_list(bot, '#testchannelpleaseignore')

    if len(bot.memory['welpcall_list']):
        winner = bot.memory['welpcall_list'][0]
        missed = set(users) - set(bot.memory['welpcall_list'])
    else:
        winner = None
        missed = users

    if '#testchannelpleaseignore' in bot.channels:
        bot.msg('#testchannelpleaseignore', 'welpcall complete.')
        bot.msg('#testchannelpleaseignore', 'Winner: ' + (winner or 'no one'))
        bot.msg('#testchannelpleaseignore',
                'Failed to welp: ' + ', '.join(missed))

    if winner:
        win_count = bot.db.get_nick_value(winner, 'welpcall_wins') or 0
        bot.db.set_nick_value(winner, 'welpcall_wins', win_count + 1)
    if missed:
        for nick in missed:
            loss_count = bot.db.get_nick_value(nick, 'welpcall_misses') or 0
            bot.db.set_nick_value(nick, 'welpcall_misses', loss_count + 1)
Ejemplo n.º 6
0
 def dehydrate_friends(self, bundle):
     return get_user_list(bundle.obj.relationships.friends())
Ejemplo n.º 7
0
 def dehydrate_following(self, bundle):
     return get_user_list(bundle.obj.relationships.following())