Skip to content

feat: update cooldown handling to support async operations#2823

Closed
Lumabots wants to merge 15 commits intoPycord-Development:masterfrom
Lumabots:async-dynamic-cooldown
Closed

feat: update cooldown handling to support async operations#2823
Lumabots wants to merge 15 commits intoPycord-Development:masterfrom
Lumabots:async-dynamic-cooldown

Conversation

@Lumabots
Copy link
Copy Markdown
Contributor

@Lumabots Lumabots commented Jun 28, 2025

Summary

it add the possibility to use async function for cooldown, it also change the internal function to use ctx instead of only message since slash commands dont have a message
Nothing should be breaking

Information

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.

@Lumabots Lumabots requested a review from a team as a code owner June 28, 2025 14:17
@pullapprove4 pullapprove4 Bot requested a review from ChickenDevs June 28, 2025 14:17
@Lumabots Lumabots changed the title fix: update cooldown handling to support async operations feat: update cooldown handling to support async operations Jun 28, 2025
… + correct typehint of max_concurrency since only ctx is passed and never message
@Lumabots
Copy link
Copy Markdown
Contributor Author

@Soheab brought to my attention that this PR might be breaking — specifically, the renaming of the message parameter to ctx could cause issues if someone is using a message cooldown, like with get_bucket(message=message).
Screenshot 2025-06-29 at 16 39 41

If they’re not using get_bucket(message=...), then there shouldn’t be any problems, since both message and ctx share all the internal attributes being accessed.

That said, I’m personally against keeping the parameter named message, especially since slash commands don’t even have a message attribute.

Let me know how you’d like to handle it. I don’t think this should be an issue — using ctx instead of message shouldn’t break anything unless a user is specifically calling that function, which I doubt many people do.

@Lumabots Lumabots requested a review from a team as a code owner August 30, 2025 13:15
@pullapprove4 pullapprove4 Bot requested a review from Dorukyum August 30, 2025 13:16
@Lulalaby Lulalaby force-pushed the master branch 2 times, most recently from b55c125 to 82659b2 Compare August 30, 2025 21:10
@Lulalaby Lulalaby removed the on hold label Aug 30, 2025
Lulalaby
Lulalaby previously approved these changes Aug 31, 2025
@Lulalaby Lulalaby requested review from Paillat-dev and removed request for ChickenDevs and Dorukyum August 31, 2025 16:33
@Lulalaby Lulalaby requested a review from JustaSqu1d August 31, 2025 16:33
@Lulalaby Lulalaby requested a review from a team as a code owner August 31, 2025 16:38
Copy link
Copy Markdown
Contributor

@DA-344 DA-344 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should've still kept the Message typings as it is still supported, and cooldown can be used in non-context contexts

Comment thread discord/ext/commands/core.py Outdated
Comment thread discord/ext/commands/core.py
Comment thread discord/ext/commands/cooldowns.py
Comment thread discord/ext/commands/cooldowns.py
Comment thread discord/ext/commands/cooldowns.py Outdated
Comment thread discord/ext/commands/cooldowns.py Outdated
Comment thread discord/ext/commands/cooldowns.py Outdated
Comment thread discord/ext/commands/cooldowns.py Outdated
Comment thread discord/ext/commands/cooldowns.py Outdated
Comment thread discord/ext/commands/core.py Outdated
Co-authored-by: DA344 <108473820+DA-344@users.noreply.github.com>
Signed-off-by: Lala Sabathil <aiko@aitsys.dev>
Comment thread discord/commands/core.py Outdated
@Lumabots
Copy link
Copy Markdown
Contributor Author

well it was not really ready for review since i thought it was going to be postpone for next, i should have kept it as draft
anyways since it seems it nows have some attention im gonna finish that up

@Lumabots
Copy link
Copy Markdown
Contributor Author

yeah as i thought, this cannot be merge for V2.7 as it will be breaking for function like is_on_cooldown

@Lulalaby Lulalaby marked this pull request as draft August 31, 2025 20:48
Lumabots and others added 3 commits August 31, 2025 22:49
Co-authored-by: Soheab <33902984+Soheab@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
@Lumabots
Copy link
Copy Markdown
Contributor Author

breaking so will be for next but in next ext will be removed, so useless and can be deleted

@Lumabots Lumabots closed this Oct 16, 2025
@Lumabots Lumabots deleted the async-dynamic-cooldown branch October 16, 2025 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants