Skip to content

feat(commands): Add support for Range[LargeInt, ...]#1201

Merged
shiftinv merged 26 commits into
DisnakeDev:masterfrom
Enegg:Eneg/large-range
Jul 4, 2026
Merged

feat(commands): Add support for Range[LargeInt, ...]#1201
shiftinv merged 26 commits into
DisnakeDev:masterfrom
Enegg:Eneg/large-range

Conversation

@Enegg

@Enegg Enegg commented Jun 2, 2024

Copy link
Copy Markdown
Contributor

Summary

Closes #787
This PR adds support for defining a range of accepted values for commands.LargeInt.

If both bounds are specified, we restrict the length of the string input according to the number of digits (and sign) of the bounds.

We also raise an error during conversion, if the provided value would exceed the defined range (for example Range[LargeInt, 100, 200] would have actual possible input of 100-999).

I've also implemented a check in case the developer attempts to define a range exceeding ±2**53 with the normal int type, directing them to LargeInt.

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 pdm lint
    • I have type-checked the code by running pdm 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, ...)

@Enegg Enegg changed the title Add support for Range[LargeInt, ...] feat(commands): Add support for Range[LargeInt, ...] Jun 2, 2024
@shiftinv shiftinv added the t: enhancement New feature label Jun 4, 2024
@Enegg Enegg mentioned this pull request Jun 22, 2024
8 tasks
@DJStompZone

Copy link
Copy Markdown

@Enegg

Enegg commented Jun 24, 2024

Copy link
Copy Markdown
Contributor Author

Tangentially related: we could add slice support for defining ranges (Range[int, 0:32], String[str, :10]). Not sure how useful it'd be.

@Enegg Enegg force-pushed the Eneg/large-range branch from f917b95 to 3bdde3d Compare June 30, 2024 18:04
Comment thread disnake/ext/commands/params.py Outdated
@github-project-automation github-project-automation Bot moved this from Todo to In Progress in disnake Sep 21, 2025
@onerandomusername

Copy link
Copy Markdown
Member

Hi, would you please resolve conflicts?

@read-the-docs-community

read-the-docs-community Bot commented Sep 21, 2025

Copy link
Copy Markdown

Documentation build overview

📚 disnake | 🛠️ Build #33440751 | 📁 Comparing 1f1b365 against latest (eb365ef)

  🔍 Preview build  

50 files changed · ± 50 modified

± Modified

Comment thread changelog/1201.feature.rst Outdated
Comment thread disnake/ext/commands/errors.py Outdated
Comment thread disnake/ext/commands/errors.py Outdated
Comment thread disnake/ext/commands/errors.py Outdated
Comment thread disnake/ext/commands/errors.py Outdated
Comment thread disnake/ext/commands/params.py Outdated
Comment thread disnake/ext/commands/params.py Outdated
Comment thread disnake/ext/commands/params.py Outdated
Comment thread disnake/ext/commands/params.py Outdated
Comment thread disnake/ext/commands/params.py
Enegg and others added 3 commits November 19, 2025 15:42
Co-authored-by: vi <8530778+shiftinv@users.noreply.github.com>
Signed-off-by: Eneg <42005170+Enegg@users.noreply.github.com>
Comment thread disnake/ext/commands/params.py Outdated
Comment thread disnake/ext/commands/params.py Outdated
Comment thread disnake/ext/commands/params.py Outdated
shiftinv and others added 3 commits June 28, 2026 14:15
Signed-off-by: vi <8530778+shiftinv@users.noreply.github.com>
This isn't immediately an issue, but prevents this documenter from being
used for members that are classes (for whatever reason that would be the case).
We only want to use it if explicitly specified through `autoclassalias::`
Comment thread tests/ext/commands/test_params.py
Enegg and others added 2 commits June 28, 2026 16:03
Co-authored-by: vi <8530778+shiftinv@users.noreply.github.com>
Signed-off-by: Eneg <42005170+Enegg@users.noreply.github.com>
Comment thread disnake/ext/commands/params.py

@shiftinv shiftinv left a comment

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.

lgtm! Thank you for all your work on this feature (and patience), really appreciate it c:

@github-project-automation github-project-automation Bot moved this from In Progress to Needs Merge in disnake Jul 4, 2026
@shiftinv shiftinv merged commit fa583f0 into DisnakeDev:master Jul 4, 2026
34 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Merge to Done in disnake Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t: enhancement New feature

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

combine commands.LargeInt with commands.Range

4 participants