Skip to content

fix(typing): support (Interaction) -> Any as type in @cooldown - #1567

Open
Enegg wants to merge 3 commits into
DisnakeDev:masterfrom
Enegg:fix-cooldowns-typings
Open

fix(typing): support (Interaction) -> Any as type in @cooldown#1567
Enegg wants to merge 3 commits into
DisnakeDev:masterfrom
Enegg:fix-cooldowns-typings

Conversation

@Enegg

@Enegg Enegg commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR changes typings of disnake.ext.commands.{cooldowns,core,base_core} to properly support Interactions (and Context).

Checklist

  • If code changes were made, then they have been tested
    • I have updated the documentation to reflect the changes
    • I have formatted the code properly by running uv run nox -s lint
    • I have type-checked the code by running uv run nox -s pyright
  • 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, ...)

@read-the-docs-community

read-the-docs-community Bot commented Jul 11, 2026

Copy link
Copy Markdown

Documentation build overview

📚 disnake | 🛠️ Build #33840702 | 📁 Comparing 99c0161 against latest (863033f)

  🔍 Preview build  

49 files changed · ± 49 modified

± Modified

Comment thread disnake/utils.py
@shiftinv shiftinv added t: refactor/typing/lint Refactors, typing changes and/or linting changes skip news labels Jul 11, 2026
@shiftinv shiftinv added this to disnake Jul 11, 2026
@github-project-automation github-project-automation Bot moved this to Todo in disnake Jul 11, 2026
Comment thread disnake/ext/commands/core.py Outdated
Comment thread disnake/ext/commands/cooldowns.py
Comment thread disnake/ext/commands/cooldowns.py
@Enegg
Enegg force-pushed the fix-cooldowns-typings branch from 6188f92 to 99c0161 Compare July 30, 2026 19:22
self._factory: Callable[[Message], Cooldown] = factory
self._factory: Callable[[ContextTypeT], Cooldown] = factory

def copy(self) -> DynamicCooldownMapping:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
def copy(self) -> DynamicCooldownMapping:
def copy(self) -> DynamicCooldownMapping[ContextTypeT]:

self._type: Callable[[Message], Any] = type
self._type: Callable[[ContextTypeT], Any] = type

def copy(self) -> CooldownMapping:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
def copy(self) -> CooldownMapping:
def copy(self) -> CooldownMapping[ContextTypeT]:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news t: refactor/typing/lint Refactors, typing changes and/or linting changes

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants