@@ -33,29 +33,29 @@ def __init__(self):
3333 self .process_lurkers_logger = process_lurkers_log_info [0 ]
3434 self .process_lurkers_debug_log_file_absolute_path = process_lurkers_log_info [1 ]
3535
36- update_outdated_profile_pics_log_info = Loggers .get_logger (
37- logger_name = "Leveling_update_outdated_profile_pics"
38- )
39- self .process_outdated_profile_pics_in_progress = False
40- self .update_outdated_profile_pics_logger = update_outdated_profile_pics_log_info [0 ]
41- self .update_outdated_profile_pics_debug_log_file_absolute_path = update_outdated_profile_pics_log_info [1 ]
42- self .update_outdated_profile_pics_warn_log_file_absolute_path = update_outdated_profile_pics_log_info [2 ]
43- self .update_outdated_profile_pics_error_log_file_absolute_path = update_outdated_profile_pics_log_info [3 ]
36+ # update_outdated_profile_pics_log_info = Loggers.get_logger(
37+ # logger_name="Leveling_update_outdated_profile_pics"
38+ # )
39+ # self.process_outdated_profile_pics_in_progress = False
40+ # self.update_outdated_profile_pics_logger = update_outdated_profile_pics_log_info[0]
41+ # self.update_outdated_profile_pics_debug_log_file_absolute_path = update_outdated_profile_pics_log_info[1]
42+ # self.update_outdated_profile_pics_warn_log_file_absolute_path = update_outdated_profile_pics_log_info[2]
43+ # self.update_outdated_profile_pics_error_log_file_absolute_path = update_outdated_profile_pics_log_info[3]
4444
4545 self .levels_have_been_changed = False
4646 self .guild : Guild | None = None
4747 self .user_points = None
4848 self .levels = None
4949 self .xp_system_ready = False
5050 self .council_channel = None
51- self .levelling_website_avatar_channel = None
51+ # self.levelling_website_avatar_channel = None
5252 self .bucket_update_in_progress = False
5353 self .NUMBER_OF_UPDATE_ATTEMPTS_PER_USER = 15
5454 self .MAX_RETRIES_FOR_FETCHING_USER = 5
5555 self .MAX_USER_UPDATE_CONCURRENT_ATTEMPTS = 30
5656 self .ensure_xp_roles_exist_and_have_right_users .start ()
5757 self .process_leveling_profile_data_for_lurkers .start ()
58- self .process_outdated_profile_pics .start ()
58+ # self.process_outdated_profile_pics.start()
5959 self .process_leveling_profile_data_for_active_users .start ()
6060
6161 @commands .Cog .listener (name = "on_ready" )
@@ -98,35 +98,35 @@ async def upload_process_lurkers_debug_logs(self):
9898 "process_lurkers"
9999 )
100100
101- @commands .Cog .listener (name = "on_ready" )
102- async def upload_outdated_profile_pics_debug_logs (self ):
103- while self .guild is None :
104- await asyncio .sleep (2 )
105- await start_file_uploading (
106- self .logger , self .guild , bot , wall_e_config ,
107- self .update_outdated_profile_pics_debug_log_file_absolute_path ,
108- "update_outdated_profile_pics"
109- )
110-
111- @commands .Cog .listener (name = "on_ready" )
112- async def upload_outdated_profile_pics_warn_logs (self ):
113- while self .guild is None :
114- await asyncio .sleep (2 )
115- await start_file_uploading (
116- self .logger , self .guild , bot , wall_e_config ,
117- self .update_outdated_profile_pics_warn_log_file_absolute_path ,
118- "update_outdated_profile_pics_warn"
119- )
120-
121- @commands .Cog .listener (name = "on_ready" )
122- async def upload_outdated_profile_pics_error_logs (self ):
123- while self .guild is None :
124- await asyncio .sleep (2 )
125- await start_file_uploading (
126- self .logger , self .guild , bot , wall_e_config ,
127- self .update_outdated_profile_pics_error_log_file_absolute_path ,
128- "update_outdated_profile_pics_error"
129- )
101+ # @commands.Cog.listener(name="on_ready")
102+ # async def upload_outdated_profile_pics_debug_logs(self):
103+ # while self.guild is None:
104+ # await asyncio.sleep(2)
105+ # await start_file_uploading(
106+ # self.logger, self.guild, bot, wall_e_config,
107+ # self.update_outdated_profile_pics_debug_log_file_absolute_path,
108+ # "update_outdated_profile_pics"
109+ # )
110+
111+ # @commands.Cog.listener(name="on_ready")
112+ # async def upload_outdated_profile_pics_warn_logs(self):
113+ # while self.guild is None:
114+ # await asyncio.sleep(2)
115+ # await start_file_uploading(
116+ # self.logger, self.guild, bot, wall_e_config,
117+ # self.update_outdated_profile_pics_warn_log_file_absolute_path,
118+ # "update_outdated_profile_pics_warn"
119+ # )
120+
121+ # @commands.Cog.listener(name="on_ready")
122+ # async def upload_outdated_profile_pics_error_logs(self):
123+ # while self.guild is None:
124+ # await asyncio.sleep(2)
125+ # await start_file_uploading(
126+ # self.logger, self.guild, bot, wall_e_config,
127+ # self.update_outdated_profile_pics_error_log_file_absolute_path,
128+ # "update_outdated_profile_pics_error"
129+ # )
130130
131131 @commands .Cog .listener (name = "on_ready" )
132132 async def updating_database_and_cache (self ):
@@ -202,29 +202,30 @@ async def create_council_channel(self):
202202 f"[Leveling create_council_channel()] text channel { self .council_channel } acquired."
203203 )
204204
205- @commands .Cog .listener (name = "on_ready" )
206- async def get_leveling_avatar_channel (self ):
207- """
208- Gets the leveling_avatar_images_channel that will be used to store the user profile pics used by the
209- leveling website
210- :return:
211- """
212- while self .guild is None :
213- await asyncio .sleep (2 )
214- self .logger .info (
215- "[Leveling get_leveling_avatar_channel()] acquiring text channel for the avatars used on the leveling"
216- " website."
217- )
218- leveling_website_avatar_images_channel_id = await bot .bot_channel_manager .create_or_get_channel_id (
219- self .logger , self .guild , wall_e_config .get_config_value ('basic_config' , 'ENVIRONMENT' ),
220- 'leveling_website_avatar_images'
221- )
222- self .levelling_website_avatar_channel : discord .TextChannel = discord .utils .get (
223- self .guild .channels if self .guild else None , id = leveling_website_avatar_images_channel_id
224- )
225- self .logger .debug (
226- f"[Leveling get_leveling_avatar_channel()] bot channel { self .levelling_website_avatar_channel } acquired."
227- )
205+ # @commands.Cog.listener(name="on_ready")
206+ # async def get_leveling_avatar_channel(self):
207+ # """
208+ # Gets the leveling_avatar_images_channel that will be used to store the user profile pics used by the
209+ # leveling website
210+ # :return:
211+ # """
212+ # while self.guild is None:
213+ # await asyncio.sleep(2)
214+ # self.logger.info(
215+ # "[Leveling get_leveling_avatar_channel()] acquiring text channel for the avatars used on the leveling"
216+ # " website."
217+ # )
218+ # leveling_website_avatar_images_channel_id = await bot.bot_channel_manager.create_or_get_channel_id(
219+ # self.logger, self.guild, wall_e_config.get_config_value('basic_config', 'ENVIRONMENT'),
220+ # 'leveling_website_avatar_images'
221+ # )
222+ # self.levelling_website_avatar_channel: discord.TextChannel = discord.utils.get(
223+ # self.guild.channels if self.guild else None, id=leveling_website_avatar_images_channel_id
224+ # )
225+ # self.logger.debug(
226+ # f"[Leveling get_leveling_avatar_channel()] bot channel {self.levelling_website_avatar_channel}
227+ # acquired."
228+ # )
228229
229230 @commands .Cog .listener (name = 'on_message' )
230231 async def on_message (self , message ):
@@ -234,7 +235,7 @@ async def on_message(self, message):
234235 :param message: the message that was sent that tripped the function call
235236 :return:
236237 """
237- while self .guild is None or self . levelling_website_avatar_channel is None :
238+ while self .guild is None :
238239 await asyncio .sleep (2 )
239240 if not message .author .bot :
240241 if not self .xp_system_ready :
@@ -538,13 +539,11 @@ async def process_leveling_profile_data_for_lurkers(self):
538539 and ensure their information has been updated for the leveling website
539540 """
540541 not_ready_to_process_lurkers = (
541- self .user_points is None or self .levelling_website_avatar_channel is None or self .guild is None or
542- self .bucket_update_in_progress
542+ self .user_points is None or self .guild is None or self .bucket_update_in_progress
543543 )
544544 self .process_lurkers_logger .debug (
545545 f"[Leveling process_leveling_profile_data_for_lurkers()] background task starting "
546- f"self.user_points is None = { self .user_points is None } | self.levelling_website_avatar_channel is None "
547- f"= { self .levelling_website_avatar_channel is None } | self.guild is None = { self .guild is None } | "
546+ f"self.user_points is None = { self .user_points is None } | self.guild is None = { self .guild is None } | "
548547 f"self.bucket_update_in_progress = { self .bucket_update_in_progress } | not_ready_to_process_lurkers = "
549548 f"{ not_ready_to_process_lurkers } "
550549 )
@@ -738,7 +737,7 @@ async def process_leveling_profile_data_for_active_users(self):
738737 and needs to have wall_e's database updated for the leveling website
739738 :return:
740739 """
741- if self .user_points is None or self .levelling_website_avatar_channel is None or self . guild is None :
740+ if self .user_points is None or self .guild is None :
742741 return
743742 updated_user_logs = await UpdatedUser .get_updated_user_logs ()
744743 total_number_of_updates_needed = len (updated_user_logs )
@@ -829,24 +828,24 @@ async def exponential_backoff_sleep(self, attempt):
829828 )
830829 await asyncio .sleep (sleep_seconds )
831830
832- @tasks .loop (seconds = 5 )
833- async def process_outdated_profile_pics (self ):
834- if self .guild is None or self .user_points is None :
835- return
836- if self .process_outdated_profile_pics_in_progress :
837- return
838- self .process_outdated_profile_pics_in_progress = True
839- user_ids_to_update = await UserPoint .get_users_with_expired_images ()
840- number_of_users_to_update = len (user_ids_to_update )
841- if number_of_users_to_update == 0 :
842- self .process_outdated_profile_pics_in_progress = False
843- return
844- self .update_outdated_profile_pics_logger .debug (
845- f"[Leveling process_outdated_profile_pics()] { number_of_users_to_update } users with outdated CDN links"
846- f" to update"
847- )
848- await self ._update_users_with_given_ids (self .update_outdated_profile_pics_logger , user_ids_to_update )
849- self .process_outdated_profile_pics_in_progress = False
831+ # @tasks.loop(seconds=5)
832+ # async def process_outdated_profile_pics(self):
833+ # if self.guild is None or self.user_points is None:
834+ # return
835+ # if self.process_outdated_profile_pics_in_progress:
836+ # return
837+ # self.process_outdated_profile_pics_in_progress = True
838+ # user_ids_to_update = await UserPoint.get_users_with_expired_images()
839+ # number_of_users_to_update = len(user_ids_to_update)
840+ # if number_of_users_to_update == 0:
841+ # self.process_outdated_profile_pics_in_progress = False
842+ # return
843+ # self.update_outdated_profile_pics_logger.debug(
844+ # f"[Leveling process_outdated_profile_pics()] {number_of_users_to_update} users with outdated CDN links"
845+ # f" to update"
846+ # )
847+ # await self._update_users_with_given_ids(self.update_outdated_profile_pics_logger, user_ids_to_update)
848+ # self.process_outdated_profile_pics_in_progress = False
850849
851850 async def _update_member_profile_data (self , logger , member , updated_user_id , index ,
852851 total_number_of_updates_needed , updated_user_log_id = None ):
@@ -881,7 +880,7 @@ async def _update_member_profile_data(self, logger, member, updated_user_id, ind
881880 # leveling_update_attempt is reset to 0 in update_leveling_profile_info if member is successfully
882881 # updated THIS time
883882 user_updated , user_processed = await self .user_points [member .id ].update_leveling_profile_info (
884- logger , self .guild .id , member , self . levelling_website_avatar_channel ,
883+ logger , self .guild .id , member , None ,
885884 updated_user_log_id = updated_user_log_id
886885 )
887886 if user_updated :
@@ -909,7 +908,7 @@ async def _update_member_profile_data(self, logger, member, updated_user_id, ind
909908 @app_commands .command (name = "reset_attempts" )
910909 @app_commands .checks .has_any_role ("Bot_manager" )
911910 async def reset_attempts (self , interaction : discord .Interaction , member_id : str ):
912- self .update_outdated_profile_pics_logger .debug (
911+ self .logger .debug (
913912 f"[Leveling reset_user_profiles()] resetting attempts for [{ member_id } ] to 0"
914913 )
915914 e_obj = None
@@ -992,18 +991,18 @@ async def reset_user_profiles(self, interaction: discord.Interaction):
992991 await interaction .followup .send (embed = e_obj )
993992 await asyncio .sleep (5 )
994993 await interaction .delete_original_response ()
995- if self .levelling_website_avatar_channel is not None :
996- await self .levelling_website_avatar_channel .delete ()
997- leveling_website_avatar_images_channel_id = await bot .bot_channel_manager .create_or_get_channel_id (
998- self .logger , self .guild , wall_e_config .get_config_value ('basic_config' , 'ENVIRONMENT' ),
999- 'leveling_website_avatar_images'
1000- )
1001- self .levelling_website_avatar_channel : discord .TextChannel = discord .utils .get (
1002- self .guild .channels , id = leveling_website_avatar_images_channel_id
1003- )
1004- self .logger .debug (
1005- f"[Leveling reset_user_profiles()] bot channel { self .levelling_website_avatar_channel } acquired."
1006- )
994+ # if self.levelling_website_avatar_channel is not None:
995+ # await self.levelling_website_avatar_channel.delete()
996+ # leveling_website_avatar_images_channel_id = await bot.bot_channel_manager.create_or_get_channel_id(
997+ # self.logger, self.guild, wall_e_config.get_config_value('basic_config', 'ENVIRONMENT'),
998+ # 'leveling_website_avatar_images'
999+ # )
1000+ # self.levelling_website_avatar_channel: discord.TextChannel = discord.utils.get(
1001+ # self.guild.channels, id=leveling_website_avatar_images_channel_id
1002+ # )
1003+ # self.logger.debug(
1004+ # f"[Leveling reset_user_profiles()] bot channel {self.levelling_website_avatar_channel} acquired."
1005+ # )
10071006 self .bucket_update_in_progress = False
10081007
10091008 @commands .command (
@@ -1248,39 +1247,39 @@ async def levels(self, ctx):
12481247
12491248 await paginate_embed (self .logger , bot , descriptions_to_embed , title = "Levels" , ctx = ctx )
12501249
1251- @commands .command (brief = "shows the current leaderboards" )
1252- async def ranks (self , ctx ):
1253- if not self .xp_system_ready :
1254- await ctx .send ("level command is not yet ready..." , reference = ctx .message )
1255- return
1256- self .logger .info (f"[Leveling ranks()] ranks command detected from { ctx .author } " )
1257- user_points = self .user_points .copy ()
1258- user_points = [
1259- user_point for user_point in list (user_points .values ())
1260- if (
1261- (user_point .user_id == ctx .author .id and user_point .hidden ) or
1262- (user_point .user_id != ctx .author .id and not user_point .hidden )
1263- )
1264- ]
1265- user_points .sort (key = lambda x : x .points , reverse = True )
1266- descriptions_to_embed = []
1267- description_to_embed = "\n User - Messages - Experience - Level\n "
1268- rank = 1
1269- for (index , user_point ) in enumerate (user_points ):
1270- if index % 10 == 0 and index > 0 :
1271- descriptions_to_embed .append (description_to_embed )
1272- description_to_embed = "\n Rank - User - Messages - Experience - Level\n "
1273- description_to_embed += (
1274- f"{ rank } - <@{ user_point .user_id } > - { user_point .message_count } - { user_point .points } "
1275- f" - { user_point .level_number } \n "
1276- )
1277- rank += 1
1278- if description_to_embed != "\n User - Messages - Experience - Level\n " :
1279- descriptions_to_embed .append (description_to_embed )
1280- if len (descriptions_to_embed ) == 0 :
1281- await ctx .send ("No users currently being tracked" , reference = ctx .message )
1282- else :
1283- await paginate_embed (self .logger , bot , descriptions_to_embed , ctx = ctx )
1250+ # @commands.command(brief="shows the current leaderboards")
1251+ # async def ranks(self, ctx):
1252+ # if not self.xp_system_ready:
1253+ # await ctx.send("level command is not yet ready...", reference=ctx.message)
1254+ # return
1255+ # self.logger.info(f"[Leveling ranks()] ranks command detected from {ctx.author}")
1256+ # user_points = self.user_points.copy()
1257+ # user_points = [
1258+ # user_point for user_point in list(user_points.values())
1259+ # if (
1260+ # (user_point.user_id == ctx.author.id and user_point.hidden) or
1261+ # (user_point.user_id != ctx.author.id and not user_point.hidden)
1262+ # )
1263+ # ]
1264+ # user_points.sort(key=lambda x: x.points, reverse=True)
1265+ # descriptions_to_embed = []
1266+ # description_to_embed = "\nUser - Messages - Experience - Level\n"
1267+ # rank = 1
1268+ # for (index, user_point) in enumerate(user_points):
1269+ # if index % 10 == 0 and index > 0:
1270+ # descriptions_to_embed.append(description_to_embed)
1271+ # description_to_embed = "\nRank - User - Messages - Experience - Level\n"
1272+ # description_to_embed += (
1273+ # f"{rank} - <@{user_point.user_id}> - {user_point.message_count} - {user_point.points}"
1274+ # f" - {user_point.level_number}\n"
1275+ # )
1276+ # rank += 1
1277+ # if description_to_embed != "\nUser - Messages - Experience - Level\n":
1278+ # descriptions_to_embed.append(description_to_embed)
1279+ # if len(descriptions_to_embed) == 0:
1280+ # await ctx.send("No users currently being tracked", reference=ctx.message)
1281+ # else:
1282+ # await paginate_embed(self.logger, bot, descriptions_to_embed, ctx=ctx)
12841283
12851284 @commands .command (
12861285 brief = "Hide a user's ranking from .rank @user and .ranks" ,
0 commit comments