def __user_info__(user_id): if user_id in [777000, 1087968824]: return """╘══「 Groups count: <code>???</code> 」""" if user_id == dispatcher.bot.id: return """╘══「 Groups count: <code>???</code> 」""" num_chats = sql.get_user_num_chats(user_id) return f"""╘══「 Groups count: <code>{num_chats}</code> 」"""
def hpmanager(user): total_hp = (get_user_num_chats(user.id) + 10) * 10 if not is_user_gbanned(user.id): # Assign new var `new_hp` since we need `total_hp` in # end to calculate percentage. new_hp = total_hp # if no username decrease 25% of hp. if not user.username: new_hp -= no_by_per(total_hp, 25) try: dispatcher.bot.get_user_profile_photos(user.id).photos[0][-1] except IndexError: # no profile photo ==> -25% of hp new_hp -= no_by_per(total_hp, 25) # if no /setme exist ==> -20% of hp if not sql.get_user_me_info(user.id): new_hp -= no_by_per(total_hp, 20) # if no bio exsit ==> -10% of hp if not sql.get_user_bio(user.id): new_hp -= no_by_per(total_hp, 10) if is_afk(user.id): afkst = check_afk_status(user.id) # if user is afk and no reason then decrease 7% # else if reason exist decrease 5% if not afkst.reason: new_hp -= no_by_per(total_hp, 7) else: new_hp -= no_by_per(total_hp, 5) # fbanned users will have (2*number of fbans) less from max HP # Example: if HP is 100 but user has 5 diff fbans # Available HP is (2*5) = 10% less than Max HP # So.. 10% of 100HP = 90HP # Commenting out fban health decrease cause it wasnt working and isnt needed ig. #_, fbanlist = get_user_fbanlist(user.id) #new_hp -= no_by_per(total_hp, 2 * len(fbanlist)) # Bad status effects: # gbanned users will always have 5% HP from max HP # Example: If HP is 100 but gbanned # Available HP is 5% of 100 = 5HP else: new_hp = no_by_per(total_hp, 5) return { "earnedhp": int(new_hp), "totalhp": int(total_hp), "percentage": get_percentage(total_hp, new_hp) }