feat: Add ComponentLimits and EmbedLimits classes for constraint defini… - #3217
feat: Add ComponentLimits and EmbedLimits classes for constraint defini…#3217Lumabots wants to merge 28 commits into
Conversation
…tions Co-authored-by: Copilot <copilot@github.com>
|
Thanks for opening this pull request! This pull request can be checked-out with: git fetch origin pull/3217/head:pr-3217
git checkout pr-3217This pull request can be installed with: pip install git+https://github.com/Pycord-Development/pycord@refs/pull/3217/head |
…enums Co-authored-by: Copilot <copilot@github.com>
Paillat-dev
left a comment
There was a problem hiding this comment.
Not sure, do we actually want these ? Seems like a pain to maintain. Or was this discussed already and I missed it ?
|
I don't mind this, but can we at least use it in the library? We hardcode all the limits currently, and just having these enums without doing anything with them does seem unnecessary. Also, maybe we shouldn't document the limits in the docs? It's easier to change the enum values when needed, and users can read it/use it from there. I think it's unlikely that users will first see it in the docs. |
|
well inside py-cord we dont even check for limit, so its not even hardcoded (except in the docs but i dont think we can change that) |
Oh yeah, not for embeds… we could do that.. |
|
i put that now for the next commit, i dont know so much what to put for min values for file as |
…ation Co-authored-by: Copilot <copilot@github.com>
|
for row, i didnt edit it as its not very clear to me, we did put row should be betwee, 5 and 1, but isnt that only for View and not designer view ? but row property in select doesnt make any difference betwee, those 2 |
|
my first reason to use enum instead of class is that they are non breaking, but i'll edit them as class |
- Introduced `EmbedLimits` class to define constraints for Discord embeds. - Removed the `ComponentLimits` enum and replaced it with a `ComponentLimits` class in `core.py` to define constraints for various UI components. - Updated all relevant UI components (Button, Checkbox, CheckboxGroup, FileUpload, InputText, MediaGallery, Modal, RadioGroup, Select, View) to use the new `ComponentLimits` class for validation. - Removed old `ComponentLimits` enum documentation from `enums.rst` and added new documentation for the `ComponentLimits` class. - Ensured all limits are consistently referenced across the codebase.
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Signed-off-by: Lumouille <144063653+Lumabots@users.noreply.github.com>
Move the ComponentLimits class from discord/ui/core.py into a new discord/ui/constant.py and update all UI modules to import ComponentLimits from .constant. Also export the constant module in discord/ui/__init__.py and remove ComponentLimits from core's exports. This centralizes UI constraint constants into a dedicated module.
Summary
Information
examples, ...).
Checklist
type: ignorecomments were used, a comment is also left explaining why.