Commit Graph

88 Commits

Author SHA1 Message Date
1e914e8945 Document Modal parameter limits 2022-04-08 23:58:18 -04:00
c68ea67213 Properly handle inheritance overriding in View subclasses 2022-04-05 09:41:48 -04:00
1458251736 Change View.children to be a property
This allows users to call remove_item in a loop. Likewise, it prevents
the footgun of doing children.append(...) which does not uphold the
invariants with the weight system.
2022-04-03 20:13:42 -04:00
0f18d93e47 Remove unused imports 2022-04-02 04:58:39 -04:00
b4fbb08818 Allow runtime modification of timeout expiry at runtime
This is done through setting View.timeout while it's running
2022-03-31 01:54:13 -04:00
e515378076 Remove annotation on row property in subclasses 2022-03-29 23:04:34 -04:00
3215cb65e2 Raise if custom_id is not a str 2022-03-29 23:04:34 -04:00
968a1f366f Change View callback order to (self, interaction, item)
This is more consistent with the rest of the library which always has
the interaction as the first parameter. This has been done before in
the command extension as well, the first parameter is always either
self or the context.
2022-03-24 23:00:50 -04:00
6d494585f5 Correct documentation for TextInput.custom_id 2022-03-23 18:38:22 -04:00
515d17405a Fix typos in some View methods' docstrings 2022-03-20 12:59:23 -04:00
Pat
94f4da9248 Change View child mutators to be fluent-style methods 2022-03-19 04:48:50 -04:00
26457b6d50 Remove automatic defer behaviour from View and Modal
This doesn't make as much sense anymore now that
InteractionResponse.edit_message exists.
2022-03-15 10:30:19 -04:00
3fd8f76c61 Add missing underscore in Modal refresh method 2022-03-14 21:00:39 -04:00
934ab4151a Mark state refresh methods as private with an underscore
People kept wondering what it is or what it does.
2022-03-14 07:50:25 -04:00
5aa696ccfa Fix typing issues and improve typing completeness across the library
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
Co-authored-by: Josh <josh.ja.butt@gmail.com>
2022-03-13 23:52:10 -04:00
c0890bfbc1 Remove unused View._expires_at private function 2022-03-13 11:50:09 -04:00
93af158b0c Refactor loop code to allow usage of asyncio.run 2022-03-13 04:54:14 -04:00
adb69e7157 Fix some spelling mistakes 2022-03-10 20:45:16 -05:00
2b600241a4 Fix Modal.stop sometimes not removing from the store 2022-03-07 17:39:00 -05:00
87415ab5a7 Fix modal docs code block warning 2022-03-06 19:16:23 -05:00
6788ec2533 Add docstring example for ui.Modal 2022-03-06 18:29:38 -05:00
4c8b1f9abd Remove unused imports 2022-03-05 21:40:42 -05:00
37d55c8ec4 Add TextInput.__str__ special method
Closes #7504
2022-03-05 21:05:46 -05:00
147948af9b Use typing.Self throughout library 2022-03-01 07:53:24 -05:00
90cabd1673 Fix various typos 2022-02-27 21:19:19 -05:00
d01e73fca5 Document more uses of type ignore 2022-02-21 23:08:26 -05:00
d409ddd227 Alter return-type of button/select decorators 2022-02-21 21:54:44 -05:00
6dbd40a8ef Remove use of typing.Self from TextInput 2022-02-21 09:13:18 -05:00
e56f64218a Rename default_value to default for TextInput 2022-02-20 11:04:50 -05:00
88b520b5ab Reformat code using black
Segments where readability was hampered were fixed by appropriate
format skipping directives. New code should hopefully be black
compatible. The moment they remove the -S option is probably the moment
I stop using black though.
2022-02-20 08:04:58 -05:00
19c6687b55 Add support for Modal Interactions 2022-02-20 04:57:44 -05:00
c22f058fa0 Fix views not being removed upon timeout 2022-02-17 07:35:12 -05:00
3382d2e9e8 Update documentation on select limits 2021-08-25 09:21:49 -04:00
0cc67e58ed Fallback to None message_id searches in View dispatch
Not all persistent views have an associated message_id attached to
them.

Fix #7319
2021-08-01 03:30:45 -04:00
b87d306a70 Remove unused variable in view 2021-08-01 02:40:11 -04:00
e795d341e7 Change View dispatch mechanism to be keyed by message_id as well
If different persistent view instances are used within different
message_ids their callbacks will get called without differentiating
between them, leading to potential issues such as 404 errors. This
change makes it so N views with custom IDs bound to N message_ids
will no longer conflict with one another.
2021-07-31 23:08:05 -04:00
ca9b371982 Add support for discord.ui.Select.disabled 2021-07-28 19:58:39 -04:00
a0e5e062c9 Add versionadded to ui.View and ui.Item 2021-07-21 02:47:52 -04:00
feed302269 Fix documentation note for interaction_check 2021-07-21 02:46:52 -04:00
f153154b7a Undocument Item.width
It doesn't serve much of a purpose to users
2021-07-09 09:14:01 -04:00
8df35c83a9 Remove extraneous dict assignment from view store 2021-07-07 20:19:17 -04:00
074f34a5fa Specify View timeouts is in seconds 2021-07-04 07:07:38 -04:00
097b6064f1 Fix ui.Button constructor default style to match the decorator 2021-07-03 21:29:28 -04:00
d7ed884593 Rework view timeouts to work as documented 2021-07-02 09:17:32 -04:00
9ac459b5d3 Add a default style for buttons
This makes it easier to create URL buttons since the library will
automatically assign the proper style for it.
2021-07-01 20:45:38 -04:00
812bfbe6f9 Show Select.values more prominently in the documentation 2021-07-01 20:33:57 -04:00
30605e6f4f Add Select to list of types in Item's docstring 2021-07-01 07:50:04 -04:00
d001b9d0ee [docs] Fix more references
Co-Authored-By: Riley Shaw <30989490+ShineyDev@users.noreply.github.com>
2021-07-01 07:48:37 -04:00
c1f1c67eed Change timeout parameter in View.from_message to keyword only 2021-06-30 03:15:45 -04:00
d8075d5412 Add View.from_message to convert message components to a View 2021-06-30 03:06:51 -04:00