Beispiel #1
0
async def check_level(user_id):
    if(User.get_xp(user_id) < User.get_max_xp(user_id)):
        return
    if(User.get_level(user_id) < Level.get_max_level_number()):
        while(User.get_xp(user_id) > User.get_max_xp(user_id)):
            if(User.get_level(user_id) < Level.get_max_level_number()):
                await levelup_notification(user_id)
                await edit_user_role(user_id)
                User.increment_level(user_id)
                level_number = User.get_level(user_id)
                level_max_xp = Level.get_max_xp(level_number)
                User.set_max_xp(user_id, level_max_xp)
            elif(User.get_level(user_id) == Level.get_max_level_number()):
                await levelup_notification(user_id)
                await edit_user_role(user_id)
                break
    elif(User.get_xp(user_id) == User.get_max_xp(user_id)):
        await levelup_notification(user_id)
        await edit_user_role(user_id)
Beispiel #2
0
 def add_users():
     members = Bot.guild.members
     for member in members:
         if not(member.bot):
             User.add(member.id, member.name, 0, Level.get_max_xp(1), 1)