@@ -201,22 +201,6 @@ async def task_update_mentor_requests(self):
201201 except Exception : # pylint: disable=broad-exception-caught
202202 logger .exception ("Unhandled exception using update_mentor_requests." )
203203
204- @task_update_mentor_requests .before_loop
205- async def before_update_mentor_requests (self ):
206- """Before starting the update_mentor_requests task, wait for ready and load data."""
207- await self .bot .wait_until_ready ()
208- await self .load_data ()
209-
210- @tasks .loop (hours = 1 )
211- async def task_delete_old_messages (self ):
212- """Task to periodically run delete_old_messages."""
213- await self .delete_old_messages ()
214-
215- @task_delete_old_messages .before_loop
216- async def before_delete_old_messages (self ):
217- """Before starting the update_mentor_requests task."""
218- await self .bot .wait_until_ready ()
219-
220204 @commands .is_owner ()
221205 @commands .dm_only ()
222206 @commands .command ()
@@ -267,6 +251,22 @@ async def requests_delete_old_messages(self, ctx: commands.Context) -> None:
267251 _ = ctx
268252 await self .delete_old_messages ()
269253
254+ @task_update_mentor_requests .before_loop
255+ async def before_update_mentor_requests (self ):
256+ """Before starting the update_mentor_requests task, wait for ready and load data."""
257+ await self .bot .wait_until_ready ()
258+ await self .load_data ()
259+
260+ @tasks .loop (hours = 1 )
261+ async def task_delete_old_messages (self ):
262+ """Task to periodically run delete_old_messages."""
263+ await self .delete_old_messages ()
264+
265+ @task_delete_old_messages .before_loop
266+ async def before_delete_old_messages (self ):
267+ """Before starting the update_mentor_requests task."""
268+ await self .bot .wait_until_ready ()
269+
270270 async def load_data (self ) -> None :
271271 """Load Exercism data."""
272272 logger .debug ("Starting load_data()" )
0 commit comments