59 Commits

Author SHA1 Message Date
Rapptz
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
Josh
19c6687b55
Add support for Modal Interactions 2022-02-20 04:57:44 -05:00
Rapptz
c22f058fa0 Fix views not being removed upon timeout 2022-02-17 07:35:12 -05:00
Rapptz
3382d2e9e8 Update documentation on select limits 2021-08-25 09:21:49 -04:00
Rapptz
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
Rapptz
b87d306a70 Remove unused variable in view 2021-08-01 02:40:11 -04:00
Rapptz
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
Lucas Hardt
ca9b371982
Add support for discord.ui.Select.disabled 2021-07-28 19:58:39 -04:00
scrazzz
a0e5e062c9
Add versionadded to ui.View and ui.Item 2021-07-21 02:47:52 -04:00
Kaylynn Morgan
feed302269
Fix documentation note for interaction_check 2021-07-21 02:46:52 -04:00
Rapptz
f153154b7a Undocument Item.width
It doesn't serve much of a purpose to users
2021-07-09 09:14:01 -04:00
Rapptz
8df35c83a9 Remove extraneous dict assignment from view store 2021-07-07 20:19:17 -04:00
Rapptz
074f34a5fa Specify View timeouts is in seconds 2021-07-04 07:07:38 -04:00
Rapptz
097b6064f1 Fix ui.Button constructor default style to match the decorator 2021-07-03 21:29:28 -04:00
Rapptz
d7ed884593 Rework view timeouts to work as documented 2021-07-02 09:17:32 -04:00
Rapptz
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
Rapptz
812bfbe6f9 Show Select.values more prominently in the documentation 2021-07-01 20:33:57 -04:00
jack1142
30605e6f4f
Add Select to list of types in Item's docstring 2021-07-01 07:50:04 -04:00
Josh
d001b9d0ee
[docs] Fix more references
Co-Authored-By: Riley Shaw <30989490+ShineyDev@users.noreply.github.com>
2021-07-01 07:48:37 -04:00
Rapptz
c1f1c67eed Change timeout parameter in View.from_message to keyword only 2021-06-30 03:15:45 -04:00
Rapptz
d8075d5412 Add View.from_message to convert message components to a View 2021-06-30 03:06:51 -04:00
Rapptz
157caaec7c Add conversion routine for SelectMenu to ui.Select 2021-06-30 02:55:03 -04:00
Nadir Chowdhury
abac04b759
Fix link buttons not being regarded as persistent 2021-06-29 20:03:50 -04:00
Josh
233d10649c
[docs] Update Sphinx and Fix various references
Co-Authored-By: Riley Shaw <30989490+ShineyDev@users.noreply.github.com>
2021-06-27 23:43:49 -04:00
Rapptz
1c640ad72b Lazily create Button custom_ids in decorator interface
The previous code would make two separate instances share the custom_id
which might have been undesirable behaviour
2021-06-12 02:33:11 -04:00
Rapptz
04573c3c06 Make View timeout parameter keyword-only 2021-06-10 09:06:04 -04:00
UP929312
4724943861
Grammatical improvements in View documentation 2021-06-08 06:54:10 -04:00
Rapptz
81e9d70b7b Add pre-conditions to avoid on_timeout being called after stop()
Apparently the cancellation request for a TimerHandle doesn't
necessarily have to be honoured despite large periods of time passing
2021-06-06 07:05:17 -04:00
Rapptz
876b1e0f3e Add View.on_error callback for swallowed exceptions 2021-06-05 08:22:44 -04:00
Rapptz
dbd9ed2c41 Add View.is_dispatching to detect whether a view has been added 2021-06-04 04:30:19 -04:00
Rapptz
47f2d04940 Allow passing Emoji in components 2021-06-02 05:30:42 -04:00
Rapptz
78275023cc Add Client.persistent_views to get all persistent views 2021-05-31 23:15:12 -04:00
Rapptz
7c40e83d10 Ensure views added to Client.add_view are persistent views 2021-05-31 23:08:08 -04:00
Rapptz
c811932ca7 Don't mark URL buttons as dispatchable 2021-05-31 22:57:44 -04:00
Rapptz
09f0ed1fba Mention that rows are explicitly 0 indexed. 2021-05-31 20:19:08 -04:00
Rapptz
d0097c4281 Remove view syncing before editing in views
This prevents a potential race condition when a MESSAGE_UPDATE is
received syncing and refreshing the view components causing a desync.
2021-05-31 05:50:40 -04:00
Rapptz
2ed3e049e1 Add View.is_finished() to query listening state 2021-05-31 00:12:08 -04:00
Rapptz
90a28d48d5 Fix potential KeyError when removing views 2021-05-30 12:29:46 -04:00
Rapptz
c9cdb47338 Add __repr__ for View 2021-05-30 11:24:23 -04:00
Rapptz
1b15772671 Allow assigning Select.options to refresh the select menu 2021-05-30 03:20:29 -04:00
Rapptz
7bd1211b36 Rework item grouping behaviour to take into consideration weights
This also renames `group` into `row`
2021-05-29 23:58:37 -04:00
Rapptz
c21d12be5e Check future state before setting result in View 2021-05-29 05:52:05 -04:00
Rapptz
f321efd4de Default SelectOption.value to the label if not given 2021-05-28 09:43:15 -04:00
Rapptz
f4fe247813 Remove __slots__ from View 2021-05-28 08:39:34 -04:00
Rapptz
ef9f61a933 Add support for select components 2021-05-28 05:34:21 -04:00
Rapptz
6874aa73c4 Add PartialEmoji.from_str helper 2021-05-28 05:34:21 -04:00
Rapptz
263f45d05b Fix View.wait not returning when it times out
This also makes it so it returns the reason why the wait finished.
2021-05-28 00:53:28 -04:00
Rapptz
3f60997630 Add a timeout callback for detecting when a View times out 2021-05-28 00:53:28 -04:00
Rapptz
97f308d219 Add View.remove_item and View.clear_items 2021-05-28 00:53:28 -04:00
Rapptz
3453992ce6 Add View.interaction_check for interaction pre-conditions 2021-05-28 00:53:28 -04:00