feat: General enhancements for views#3093
feat: General enhancements for views#3093NeloBlivion wants to merge 77 commits intoPycord-Development:masterfrom
Conversation
* fix(actions): rework release workflow * style(pre-commit): auto fixes from pre-commit.com hooks --------- Co-Authored-By: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: Lala Sabathil <[email protected]>
Signed-off-by: Nelo <[email protected]>
Signed-off-by: Nelo <[email protected]>
|
Thanks for opening this pull request! This pull request can be checked-out with: git fetch origin pull/3093/head:pr-3093
git checkout pr-3093This pull request can be installed with: pip install git+https://github.com/Pycord-Development/pycord@refs/pull/3093/head |
Signed-off-by: Nelo <[email protected]>
Co-authored-by: Soheab <[email protected]> Signed-off-by: Nelo <[email protected]>
Signed-off-by: Nelo <[email protected]>
|
What is missing for this to be undrafted ? |
| The item with the matching ``custom_id``, ``id``, or ``attrs`` if it exists. | ||
| """ | ||
| if not custom_id: | ||
| if not (custom_id or attrs): |
There was a problem hiding this comment.
This could just be if, elif, else : return None and would be clearer I think ?
| if isinstance(original_item, (str, int)): | ||
| original_item = self.get_item(original_item) | ||
| if not original_item: | ||
| raise ValueError(f"Could not find original_item in section.") |
There was a problem hiding this comment.
Albeit a bit weird, this error would also raise if a user (incorrectly) passes None or another falsy value as original_item. Would not be an issue to care about normally, really, but since we already verify the types for new_item we should probably for original_item ? Idk...
|
|
||
| .. warning:: | ||
|
|
||
| You may specify only **one** of ``index``, ``before``, & ``after``. ``into`` will work together with those parameters. |
There was a problem hiding this comment.
Could benefit some overloads ig
| f"cannot add Select or Button to DesignerView directly. Use ActionRow instead." | ||
| ) | ||
|
|
||
| super().add_item(item) |
There was a problem hiding this comment.
Is it me or the arguments are just not being used ?
Summary
Isolates features previously introduced in #3032
replace_itemadded toDesignerView,ActionRow,Section,Container, andMediaGalleryadd_itemsupports positioning with parametersbefore,after, andindexget_itemsupports getting items by any attribute instead of justidandcustom_idMessage.get_view?Information
examples, ...).
Checklist
type: ignorecomments were used, a comment is also left explaining why.