@@ -18,11 +18,11 @@ async def process_daily_overview(users, api_username, api_key, channel):
1818 profile = UserProfile (user , api_username , api_key )
1919 achievements = user_completion .get_achievements ()
2020 if achievements : # Only process if there are achievements
21- achievement_count , daily_points , daily_retropoints = count_daily_points (achievements )
21+ achievement_count , daily_hardcore_points , daily_softcore_points , daily_retropoints = count_daily_points (achievements )
2222 max_achievement = find_max_achievement (achievements )
2323 fav_game_details = favorite_game (achievements )
24- logger .info (f"{ user } has earned { achievement_count } achievements today, totaling { daily_points } points and { daily_retropoints } RetroPoints. Their favorite game is { fav_game_details [0 ]} with { fav_game_details [1 ]} achievements." )
25- embed = create_embed (profile , achievement_count , daily_points , daily_retropoints , max_achievement , * fav_game_details )
24+ logger .info (f"{ user } has earned { achievement_count } achievements today, totaling { daily_hardcore_points } Hardcore points, { daily_softcore_points } Softcore points and { daily_retropoints } RetroPoints. Their favorite game is { fav_game_details [0 ]} with { fav_game_details [1 ]} achievements." )
25+ embed = create_embed (profile , daily_hardcore_points , daily_softcore_points , daily_retropoints , max_achievement , * fav_game_details , achievements )
2626 all_embeds .append (embed )
2727 except Exception as e :
2828 logger .error (f'Error processing user { user } : { e } ' )
@@ -34,9 +34,17 @@ async def process_daily_overview(users, api_username, api_key, channel):
3434
3535def count_daily_points (achievements ):
3636 achievement_count = len (achievements ) if achievements else 0
37- daily_points = sum (achievement .points for achievement in achievements ) if achievements else 0
38- daily_retropoints = sum (achievement .retropoints for achievement in achievements ) if achievements else 0
39- return achievement_count , format_points (daily_points ), format_points (daily_retropoints )
37+
38+ daily_hardcore_points = sum (a .points for a in achievements if a .mode == "Hardcore" ) if achievements else 0
39+ daily_softcore_points = sum (a .points for a in achievements if a .mode == "Softcore" ) if achievements else 0
40+ daily_retropoints = sum (a .retropoints for a in achievements if a .mode == "Hardcore" ) if achievements else 0 # No RetroPoints for Softcore
41+
42+ return (
43+ achievement_count ,
44+ format_points (daily_hardcore_points ),
45+ format_points (daily_softcore_points ),
46+ format_points (daily_retropoints )
47+ )
4048
4149def find_max_achievement (achievements ):
4250 return max (achievements , key = lambda achievement : (achievement .points , achievement .retropoints ), default = None )
@@ -57,10 +65,10 @@ def extract_favorite_game(game_counts):
5765 fav_details = game_counts [favorite_game ]
5866 return favorite_game , fav_details [0 ], fav_details [1 ], fav_details [2 ], format_points (fav_details [3 ]), format_points (fav_details [4 ])
5967
60- def create_embed (profile , achievement_count , daily_points , daily_retropoints , max_achievement , fav_game , fav_game_achievements , fav_url , fav_console_name , fav_game_points , fav_game_retropoints ):
68+ def create_embed (profile , daily_hardcore_points , daily_softcore_points , daily_retropoints , max_achievement , fav_game , fav_game_achievements , fav_url , fav_console_name , fav_game_points , fav_game_retropoints , achievements ):
6169 embed_color = get_discord_color (max_achievement .badge_url if max_achievement else profile .profile .user_pic_unique )
6270 embed = discord .Embed (title = '' , description = '' , color = embed_color ).set_footer (
63- text = f"Total Points: { profile .profile .total_points_format } • Total RetroPoints : { profile .profile .total_true_points_format } " ,
71+ text = f"Hardcore Points: { profile .profile .total_points_format } • Softcore Points: { profile . profile . total_softcore_points } • Retro Points : { profile .profile .total_true_points_format } " ,
6472 icon_url = profile .profile .user_pic_unique
6573 ).set_author (
6674 name = f"Daily Overview for { profile .profile .user } " ,
@@ -69,15 +77,42 @@ def create_embed(profile, achievement_count, daily_points, daily_retropoints, ma
6977 url = DISCORD_IMAGE
7078 )
7179 if max_achievement :
80+ hardcore_count = sum (1 for a in achievements if a .mode == "Hardcore" )
81+ softcore_count = sum (1 for a in achievements if a .mode == "Softcore" )
82+
83+ achievement_mode_text = f"[{ profile .profile .user } ]({ profile .profile .user_url } ) has earned "
84+ if hardcore_count > 0 and softcore_count > 0 :
85+ achievement_mode_text += f"{ softcore_count } softcore achievement{ 's' if softcore_count != 1 else '' } and { hardcore_count } hardcore achievement{ 's' if hardcore_count != 1 else '' } today.\n \n "
86+ elif hardcore_count > 0 :
87+ achievement_mode_text += f"{ hardcore_count } hardcore achievement{ 's' if hardcore_count != 1 else '' } today.\n \n "
88+ elif softcore_count > 0 :
89+ achievement_mode_text += f"{ softcore_count } softcore achievement{ 's' if softcore_count != 1 else '' } today.\n \n "
90+
7291 embed .set_thumbnail (url = max_achievement .badge_url )
7392 embed .description = (
74- f"[ { profile . profile . user } ]( { profile . profile . user_url } ) has earned ** { achievement_count } ** achievements today. \n \n "
93+ f"{ achievement_mode_text } "
7594 f"[{ fav_game } ]({ fav_url } ) ({ fav_console_name } ) is the game with the most earned **({ fav_game_achievements } )** achievements today.\n "
76- f"**{ fav_game_points } ** Points and **{ fav_game_retropoints } ** RetroPoints.\n \n "
95+ )
96+ if daily_hardcore_points != "0" :
97+ embed .description += f"**{ fav_game_points } ** Hardcore Points and **{ fav_game_retropoints } ** Retro Points.\n \n "
98+ else :
99+ embed .description += f"**{ fav_game_points } ** Softcore Points.\n \n "
100+
101+ embed .description += (
77102 f"[{ max_achievement .title } ]({ max_achievement .url } ) from [{ max_achievement .game_title } ]({ max_achievement .game_url } ) ({ max_achievement .remap_console_name ()} ) is the top achievement of the day.\n "
78- f"**{ max_achievement .points } ** Points and **{ max_achievement .retropoints_format } ** RetroPoints.\n \n "
79- f"***{ daily_points } ** Points and **{ daily_retropoints } ** RetroPoints have been earned in total today.*"
80103 )
104+ if max_achievement .mode == "Hardcore" :
105+ embed .description += f"**{ max_achievement .points } ** Hardcore Points and **{ max_achievement .retropoints_format } ** Retro Points.\n \n "
106+ else :
107+ embed .description += f"**{ max_achievement .points } ** Hardcore Points.\n \n "
108+
109+ if daily_hardcore_points != "0" :
110+ embed .description += f"***{ daily_hardcore_points } ** Hardcore Points and **{ daily_retropoints } ** Retro Points have been earned in total today.*"
111+ elif daily_softcore_points != "0" :
112+ embed .description += f"***{ daily_softcore_points } ** Softcore Points have been earned in total today.*"
113+ else :
114+ embed .description += "***0** Points have been earned in total today.*"
115+
81116 else :
82117 embed .description = 'Nothing has been earned today.'
83118 return embed
0 commit comments