Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nextcord.Range accepts negative numbers if min_value is 0. #1015

Open
3 tasks done
ranshaa05 opened this issue Mar 20, 2023 · 2 comments
Open
3 tasks done

nextcord.Range accepts negative numbers if min_value is 0. #1015

ranshaa05 opened this issue Mar 20, 2023 · 2 comments
Labels
t: bug Type: bug - something isn't working

Comments

@ranshaa05
Copy link

Summary

if the minimum value of nextcord.Range[x. y] is zero, negative numbers will be also accepted.

Reproduction Steps

  • have a function that uses a field that has a nextcord.Range[0, X] argument.
  • type -1 into that field on discord

Minimal Reproducible Code

seed: nextcord.Range[0, 99999] = nextcord.SlashOption()

Expected Results

Discord should not accept negative numbers if the minimum value is zero.

Actual Results

i was able to input negative numbers into the field and they were accepted as valid.

Intents

nextcord.Intents().all()

System Information

  • Python v3.11.2-final
  • nextcord v2.4.1-final
  • aiohttp v3.8.4
  • system info: Windows 10 10.0.19045

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

No response

@ranshaa05 ranshaa05 added the t: unconfirmed bug Type: bug - needs testing on if this is an issue label Mar 20, 2023
@spifory
Copy link
Collaborator

spifory commented Mar 21, 2023

I can reproduce this.

@client.slash_command()
async def cmd(_: Interaction, opt: Range[0, -1] = SlashOption()):
    ...

Although I'm pretty sure that passing 0 as a minimum length is another way in saying "anything below the maximum number (negative or not) is allowed" as shown here
image

Although, I did also try making the minimum length 1 and the maximum length -1, which actually works. So this is a Discord bug (not too sure if it's a bug though, since it's been like this since max/min lengths for options were a thing) and not really something that we (as nextcord) can do about it.

@client.slash_command()
async def cmd(_: Interaction, opt: Range[1, -1] = SlashOption()):
    ...

image

@ranshaa05
Copy link
Author

ranshaa05 commented Mar 21, 2023

So is there no way to accept a range that starts at 0 beside accepting a range that starts with 1 and shifting it one lower?
also, shouldn't passing "..." as the minimum be the way to accept any number and not "0"?

@Skelmis Skelmis added t: bug Type: bug - something isn't working and removed t: unconfirmed bug Type: bug - needs testing on if this is an issue labels Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t: bug Type: bug - something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants