File tree Expand file tree Collapse file tree
bot/exts/moderation/infraction Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -241,15 +241,19 @@ async def _fetch_with_retries(self,
241241 retries : int = URLs .connect_max_retries ,
242242 params : dict [str , str ] | None = None ) -> list [dict ]:
243243 """Fetch infractions from the API with retries and exponential backoff."""
244- for attempt in range (retries ):
244+ if retries < 1 :
245+ raise ValueError ("retries must be at least 1" )
246+
247+ for attempt in range (1 , retries + 1 ):
245248 try :
246249 return await self .bot .api_client .get ("bot/infractions" , params = params )
247250 except Exception as e :
248- if attempt == retries - 1 or not is_retryable_api_error (e ):
251+ if attempt == retries or not is_retryable_api_error (e ):
249252 raise
250253 await asyncio .sleep (URLs .connect_initial_backoff * (2 ** (attempt - 1 )))
251254 return None
252255
256+
253257async def setup (bot : Bot ) -> None :
254258 """Load the Superstarify cog."""
255259 await bot .add_cog (Superstarify (bot ))
You can’t perform that action at this time.
0 commit comments