File tree Expand file tree Collapse file tree 3 files changed +10
-13
lines changed Expand file tree Collapse file tree 3 files changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -336,7 +336,7 @@ def guild_only(self, value: bool) -> None:
336
336
async def _prepare_cooldowns (self , ctx : ApplicationContext ):
337
337
if self ._buckets .valid :
338
338
current = datetime .datetime .now ().timestamp ()
339
- bucket = await self ._buckets .get_bucket (ctx , current ) # type: ignore # ctx instead of non-existent message
339
+ bucket = await self ._buckets .get_bucket (ctx , current )
340
340
341
341
if bucket is not None :
342
342
retry_after = bucket .update_rate_limit (current )
@@ -356,9 +356,7 @@ async def prepare(self, ctx: ApplicationContext) -> None:
356
356
)
357
357
358
358
if self ._max_concurrency is not None :
359
- # For this application, context can be duck-typed as a Message
360
- await self ._max_concurrency .acquire (ctx ) # type: ignore # ctx instead of non-existent message
361
-
359
+ await self ._max_concurrency .acquire (ctx )
362
360
try :
363
361
await self ._prepare_cooldowns (ctx )
364
362
await self .call_before_hooks (ctx )
@@ -400,7 +398,7 @@ def reset_cooldown(self, ctx: ApplicationContext) -> None:
400
398
The invocation context to reset the cooldown under.
401
399
"""
402
400
if self ._buckets .valid :
403
- bucket = self ._buckets .get_bucket (ctx ) # type: ignore # ctx instead of non-existent message
401
+ bucket = self ._buckets .get_bucket (ctx )
404
402
bucket .reset ()
405
403
406
404
def get_cooldown_retry_after (self , ctx : ApplicationContext ) -> float :
Original file line number Diff line number Diff line change @@ -399,11 +399,11 @@ def __repr__(self) -> str:
399
399
f"<MaxConcurrency per={ self .per !r} number={ self .number } wait={ self .wait } >"
400
400
)
401
401
402
- def get_key (self , message : Message ) -> Any :
403
- return self .per .get_key (message )
402
+ def get_key (self , ctx : Context | ApplicationContext ) -> Any :
403
+ return self .per .get_key (ctx )
404
404
405
- async def acquire (self , message : Message ) -> None :
406
- key = self .get_key (message )
405
+ async def acquire (self , ctx : Context | ApplicationContext ) -> None :
406
+ key = self .get_key (ctx )
407
407
408
408
try :
409
409
sem = self ._mapping [key ]
@@ -414,10 +414,10 @@ async def acquire(self, message: Message) -> None:
414
414
if not acquired :
415
415
raise MaxConcurrencyReached (self .number , self .per )
416
416
417
- async def release (self , message : Message ) -> None :
417
+ async def release (self , ctx : Context | ApplicationContext ) -> None :
418
418
# Technically there's no reason for this function to be async
419
419
# But it might be more useful in the future
420
- key = self .get_key (message )
420
+ key = self .get_key (ctx )
421
421
422
422
try :
423
423
sem = self ._mapping [key ]
Original file line number Diff line number Diff line change @@ -873,8 +873,7 @@ async def prepare(self, ctx: Context) -> None:
873
873
)
874
874
875
875
if self ._max_concurrency is not None :
876
- # For this application, context can be duck-typed as a Message
877
- await self ._max_concurrency .acquire (ctx ) # type: ignore
876
+ await self ._max_concurrency .acquire (ctx )
878
877
879
878
try :
880
879
if self .cooldown_after_parsing :
You can’t perform that action at this time.
0 commit comments