PycordViews 1.2.23__py3-none-any.whl → 1.2.24__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pycordViews/menu/menu.py +8 -5
- pycordViews/menu/selectMenu.py +11 -4
- {pycordviews-1.2.23.dist-info → pycordviews-1.2.24.dist-info}/METADATA +1 -1
- {pycordviews-1.2.23.dist-info → pycordviews-1.2.24.dist-info}/RECORD +7 -7
- {pycordviews-1.2.23.dist-info → pycordviews-1.2.24.dist-info}/WHEEL +0 -0
- {pycordviews-1.2.23.dist-info → pycordviews-1.2.24.dist-info}/licenses/LICENSE +0 -0
- {pycordviews-1.2.23.dist-info → pycordviews-1.2.24.dist-info}/top_level.txt +0 -0
pycordViews/menu/menu.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
from discord.components import ComponentType
|
2
2
|
from discord.ui import Select, Item
|
3
|
-
from discord import MISSING, Emoji, PartialEmoji,
|
4
|
-
from typing import Callable, Union
|
3
|
+
from discord import MISSING, Emoji, PartialEmoji, Role
|
4
|
+
from typing import Callable, Union, Optional, Any
|
5
5
|
|
6
6
|
from .errors import NotCoroutineError, ComponentTypeError
|
7
7
|
|
@@ -16,15 +16,18 @@ class Menu:
|
|
16
16
|
self.__selectMenu = selectmenu
|
17
17
|
self.__menu_type: ComponentType = menu_type
|
18
18
|
|
19
|
-
def set_callable(self, _callable: Union[Callable, None]
|
19
|
+
def set_callable(self, _callable: Union[Callable, None],
|
20
|
+
data: Optional[dict[str, Any]] = None,
|
21
|
+
autorised_roles : Optional[list[Union[int, Role]]] = None,
|
22
|
+
autorised_key: Optional[Callable] = None) -> "Menu":
|
20
23
|
"""
|
21
24
|
Add a coroutine to the menu (same function on SelectMenu class)
|
22
|
-
This coroutine can have
|
25
|
+
This coroutine can have 3 parameters (X, interaction, data)
|
23
26
|
"""
|
24
27
|
if not isinstance(_callable, Callable):
|
25
28
|
raise NotCoroutineError(_callable)
|
26
29
|
|
27
|
-
self.__selectMenu.set_callable(self.__menu.custom_id, _callable=_callable)
|
30
|
+
self.__selectMenu.set_callable(self.__menu.custom_id, _callable=_callable, data=data, autorised_roles=autorised_roles, autorised_key=autorised_key)
|
28
31
|
return self
|
29
32
|
|
30
33
|
def add_option(self, label: str, value: str = MISSING, description: Union[str, None] = None, emoji: Union[str, Emoji, PartialEmoji, None] = None, default: bool = False) -> "Menu":
|
pycordViews/menu/selectMenu.py
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
from ..views.easy_modified_view import EasyModifiedViews
|
3
3
|
from .menu import Menu
|
4
4
|
|
5
|
-
from typing import Union, Callable, Any
|
5
|
+
from typing import Union, Callable, Any, Optional
|
6
6
|
from discord.components import ComponentType
|
7
|
-
from discord import ChannelType, Member, ApplicationContext, Interaction
|
7
|
+
from discord import ChannelType, Member, ApplicationContext, Interaction, Role
|
8
8
|
from discord.abc import GuildChannel
|
9
9
|
|
10
10
|
class SelectMenu:
|
@@ -99,13 +99,20 @@ class SelectMenu:
|
|
99
99
|
|
100
100
|
return menu
|
101
101
|
|
102
|
-
def set_callable(self, *custom_ids: str,
|
102
|
+
def set_callable(self, *custom_ids: str,
|
103
|
+
_callable: Union[Callable, None],
|
104
|
+
data: Optional[dict[str, Any]] = None,
|
105
|
+
autorised_roles : Optional[list[Union[int, Role]]] = None,
|
106
|
+
autorised_key: Optional[Callable] = None) -> "SelectMenu":
|
103
107
|
"""
|
104
108
|
Set a callable for menus associated with custom_ids
|
105
109
|
:param custom_ids: IDs menus
|
106
110
|
:param _callable: The coroutine to set for all menus
|
111
|
+
:param data: Add any data to pass in called function.
|
112
|
+
:param autorised_roles: Any role ID allowed to interact with the view
|
113
|
+
:param autorised_key: Callable function to check anything. The function get the current interaction passed in parameter
|
107
114
|
"""
|
108
|
-
self.__select_menu.set_callable(*custom_ids, _callable=_callable)
|
115
|
+
self.__select_menu.set_callable(*custom_ids, _callable=_callable, data=data, autorised_key=autorised_key, autorised_roles=autorised_roles)
|
109
116
|
return self
|
110
117
|
|
111
118
|
async def respond(self, ctx: Union[ApplicationContext, Interaction], *args, **kwargs) -> Any:
|
@@ -4,8 +4,8 @@ pycordViews/kit/confirm.py,sha256=lc0T8HxVtQdkMo42_3CJPYT7Q501348WGG7FUvPFNBM,28
|
|
4
4
|
pycordViews/kit/poll.py,sha256=9PQfeEUvNZUmO8-NsWbERZwCpw5BudUGBvDG-rVwt2g,7092
|
5
5
|
pycordViews/menu/__init__.py,sha256=QUXA9ezyeTScvS1kxMNFgKEbZMsPq5yUnWWgbXCytCk,97
|
6
6
|
pycordViews/menu/errors.py,sha256=0Um-oH5qMdWSZB_bGlqILsf9WSDtC4n_HwkheekiMV4,480
|
7
|
-
pycordViews/menu/menu.py,sha256=
|
8
|
-
pycordViews/menu/selectMenu.py,sha256=
|
7
|
+
pycordViews/menu/menu.py,sha256=loYAc6glrzI462V8deXK4wnjcbb7uRwnmtATf30bS80,4599
|
8
|
+
pycordViews/menu/selectMenu.py,sha256=CoXYPH7ZIRRbQWtXpXBY0hlfPiotLK0rfI1ZtEtN6Pg,11080
|
9
9
|
pycordViews/modal/__init__.py,sha256=TFUX3z25oInBhBzoOQhnLbKmwArXo4IVVqBfN6y11Bo,61
|
10
10
|
pycordViews/modal/easy_modal_view.py,sha256=sNxfSg6sgoiKa3vc6eKa4RV7vNVNaSrI1XUJ9RMSD80,4281
|
11
11
|
pycordViews/modal/errors.py,sha256=nIGYyOS_oWH49Dj8ZGW53nnzaPmbvFbAo7ydikD5xWE,307
|
@@ -21,8 +21,8 @@ pycordViews/pagination/pagination_view.py,sha256=g-cTCx3D3qMddOqMmFPKVuxplB_EpN7
|
|
21
21
|
pycordViews/views/__init__.py,sha256=yligptZmw-np8tjKLr76SVmi0807Nk6jCyKkKYLhbCY,89
|
22
22
|
pycordViews/views/easy_modified_view.py,sha256=HJfq_zSZaxzt84DLmFd-T2I7G79x4lgakI_dzX7jHh4,14000
|
23
23
|
pycordViews/views/errors.py,sha256=AkhGskuBjbFs0ZQdTDlVyfvAJ1WRMMQx2sAXUnYjmog,360
|
24
|
-
pycordviews-1.2.
|
25
|
-
pycordviews-1.2.
|
26
|
-
pycordviews-1.2.
|
27
|
-
pycordviews-1.2.
|
28
|
-
pycordviews-1.2.
|
24
|
+
pycordviews-1.2.24.dist-info/licenses/LICENSE,sha256=lNgcw1_xb7QENAQi3uHGymaFtbs0RV-ihiCd7AoLQjA,1082
|
25
|
+
pycordviews-1.2.24.dist-info/METADATA,sha256=RqOT3Nl4z9u3w-9jTWHDTY_KLKAhzXbVlZqYf6fGOus,11947
|
26
|
+
pycordviews-1.2.24.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
27
|
+
pycordviews-1.2.24.dist-info/top_level.txt,sha256=3NvgH6MjESe7Q6jb6aqHgdYrYb5NhxwxnoDyE6PkThY,125
|
28
|
+
pycordviews-1.2.24.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|