PycordViews 1.2.22__tar.gz → 1.2.24__tar.gz

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.
Files changed (34) hide show
  1. {pycordviews-1.2.22 → pycordviews-1.2.24}/PKG-INFO +1 -1
  2. {pycordviews-1.2.22 → pycordviews-1.2.24}/PycordViews.egg-info/PKG-INFO +1 -1
  3. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/menu/menu.py +8 -5
  4. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/menu/selectMenu.py +12 -5
  5. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/pagination/pagination_view.py +1 -1
  6. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/views/easy_modified_view.py +2 -2
  7. {pycordviews-1.2.22 → pycordviews-1.2.24}/setup.py +1 -1
  8. {pycordviews-1.2.22 → pycordviews-1.2.24}/LICENSE +0 -0
  9. {pycordviews-1.2.22 → pycordviews-1.2.24}/PycordViews.egg-info/SOURCES.txt +0 -0
  10. {pycordviews-1.2.22 → pycordviews-1.2.24}/PycordViews.egg-info/dependency_links.txt +0 -0
  11. {pycordviews-1.2.22 → pycordviews-1.2.24}/PycordViews.egg-info/requires.txt +0 -0
  12. {pycordviews-1.2.22 → pycordviews-1.2.24}/PycordViews.egg-info/top_level.txt +0 -0
  13. {pycordviews-1.2.22 → pycordviews-1.2.24}/README.md +0 -0
  14. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/__init__.py +0 -0
  15. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/kit/__init__.py +0 -0
  16. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/kit/confirm.py +0 -0
  17. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/kit/poll.py +0 -0
  18. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/menu/__init__.py +0 -0
  19. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/menu/errors.py +0 -0
  20. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/modal/__init__.py +0 -0
  21. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/modal/easy_modal_view.py +0 -0
  22. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/modal/errors.py +0 -0
  23. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/multibot/__init__.py +0 -0
  24. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/multibot/bot.py +0 -0
  25. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/multibot/errors.py +0 -0
  26. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/multibot/multibot.py +0 -0
  27. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/multibot/process.py +0 -0
  28. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/pagination/__init__.py +0 -0
  29. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/pagination/errors.py +0 -0
  30. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/pagination/page.py +0 -0
  31. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/views/__init__.py +0 -0
  32. {pycordviews-1.2.22 → pycordviews-1.2.24}/pycordViews/views/errors.py +0 -0
  33. {pycordviews-1.2.22 → pycordviews-1.2.24}/pyproject.toml +0 -0
  34. {pycordviews-1.2.22 → pycordviews-1.2.24}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PycordViews
3
- Version: 1.2.22
3
+ Version: 1.2.24
4
4
  Summary: Views and multibot for py-cord library
5
5
  Home-page: https://github.com/BOXERRMD/Py-cord_Views
6
6
  Author: Chronos (alias BOXERRMD)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PycordViews
3
- Version: 1.2.22
3
+ Version: 1.2.24
4
4
  Summary: Views and multibot for py-cord library
5
5
  Home-page: https://github.com/BOXERRMD/Py-cord_Views
6
6
  Author: Chronos (alias BOXERRMD)
@@ -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, Interaction
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]) -> "Menu":
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 2 parameters (X, interaction)
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":
@@ -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
7
+ from discord import ChannelType, Member, ApplicationContext, Interaction, Role
8
8
  from discord.abc import GuildChannel
9
9
 
10
10
  class SelectMenu:
@@ -99,16 +99,23 @@ class SelectMenu:
99
99
 
100
100
  return menu
101
101
 
102
- def set_callable(self, *custom_ids: str, _callable: Union[Callable, None]) -> "SelectMenu":
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
- async def respond(self, ctx: ApplicationContext, *args, **kwargs) -> Any:
118
+ async def respond(self, ctx: Union[ApplicationContext, Interaction], *args, **kwargs) -> Any:
112
119
  """
113
120
  Respond at the ApplicationContext
114
121
  """
@@ -110,7 +110,7 @@ class Pagination:
110
110
  first_page = self.__pages[0]
111
111
  return await self.__view.send(target=target, content=first_page.content, embeds=first_page.embeds, files=first_page.files, view=self.__view.copy() + first_page.get_page_view)
112
112
 
113
- async def respond(self, ctx: ApplicationContext) -> Any:
113
+ async def respond(self, ctx: Union[ApplicationContext, Interaction]) -> Any:
114
114
  """
115
115
  Respond to the command call
116
116
  :param ctx: ApplicationContext to respond
@@ -43,9 +43,9 @@ class EasyModifiedViews(View):
43
43
  if custom_id not in self.__callback.keys():
44
44
  raise CustomIDNotFound()
45
45
 
46
- async def respond(self, ctx: ApplicationContext, *args, **kwargs) -> None:
46
+ async def respond(self, ctx: Union[ApplicationContext, Interaction], *args, **kwargs) -> None:
47
47
  """
48
- Respond at the ApplicationContext
48
+ Respond at the ApplicationContext or Interaction
49
49
  """
50
50
  self.__ctx = await ctx.respond(*args, **kwargs)
51
51
 
@@ -5,7 +5,7 @@ with open("README.md", encoding='utf-8') as file:
5
5
 
6
6
  setup(
7
7
  name="PycordViews",
8
- version="1.2.22",
8
+ version="1.2.24",
9
9
  url="https://github.com/BOXERRMD/Py-cord_Views",
10
10
  author="Chronos (alias BOXERRMD)",
11
11
  author_email="vagabonwalybi@gmail.com",
File without changes
File without changes
File without changes