|
|
@ -2681,7 +2681,7 @@ class Client: |
|
|
|
return state.add_dm_channel(data) |
|
|
|
|
|
|
|
def add_dynamic_items(self, *items: Type[DynamicItem[Item[Any]]]) -> None: |
|
|
|
r"""Registers a :class:`~discord.ui.DynamicItem` class for persistent listening. |
|
|
|
r"""Registers :class:`~discord.ui.DynamicItem` classes for persistent listening. |
|
|
|
|
|
|
|
This method accepts *class types* rather than instances. |
|
|
|
|
|
|
@ -2695,7 +2695,7 @@ class Client: |
|
|
|
Raises |
|
|
|
------- |
|
|
|
TypeError |
|
|
|
The class is not a subclass of :class:`~discord.ui.DynamicItem`. |
|
|
|
A class is not a subclass of :class:`~discord.ui.DynamicItem`. |
|
|
|
""" |
|
|
|
|
|
|
|
for item in items: |
|
|
@ -2704,6 +2704,30 @@ class Client: |
|
|
|
|
|
|
|
self._connection.store_dynamic_items(*items) |
|
|
|
|
|
|
|
def remove_dynamic_items(self, *items: Type[DynamicItem[Item[Any]]]) -> None: |
|
|
|
r"""Removes :class:`~discord.ui.DynamicItem` classes from persistent listening. |
|
|
|
|
|
|
|
This method accepts *class types* rather than instances. |
|
|
|
|
|
|
|
.. versionadded:: 2.4 |
|
|
|
|
|
|
|
Parameters |
|
|
|
----------- |
|
|
|
\*items: Type[:class:`~discord.ui.DynamicItem`] |
|
|
|
The classes of dynamic items to remove. |
|
|
|
|
|
|
|
Raises |
|
|
|
------- |
|
|
|
TypeError |
|
|
|
A class is not a subclass of :class:`~discord.ui.DynamicItem`. |
|
|
|
""" |
|
|
|
|
|
|
|
for item in items: |
|
|
|
if not issubclass(item, DynamicItem): |
|
|
|
raise TypeError(f'expected subclass of DynamicItem not {item.__name__}') |
|
|
|
|
|
|
|
self._connection.remove_dynamic_items(*items) |
|
|
|
|
|
|
|
def add_view(self, view: View, *, message_id: Optional[int] = None) -> None: |
|
|
|
"""Registers a :class:`~discord.ui.View` for persistent listening. |
|
|
|
|
|
|
|