Support for Soundboard and VC effects

This commit is contained in:
Andrin
2024-10-09 23:05:17 +02:00
committed by GitHub
parent 59f877fcf0
commit a70217a719
19 changed files with 1185 additions and 26 deletions

View File

@ -77,6 +77,7 @@ from .ui.dynamic import DynamicItem
from .stage_instance import StageInstance
from .threads import Thread
from .sticker import GuildSticker, StandardSticker, StickerPack, _sticker_factory
from .soundboard import SoundboardDefaultSound, SoundboardSound
if TYPE_CHECKING:
from types import TracebackType
@ -383,6 +384,14 @@ class Client:
"""
return self._connection.stickers
@property
def soundboard_sounds(self) -> List[SoundboardSound]:
"""List[:class:`.SoundboardSound`]: The soundboard sounds that the connected client has.
.. versionadded:: 2.5
"""
return self._connection.soundboard_sounds
@property
def cached_messages(self) -> Sequence[Message]:
"""Sequence[:class:`.Message`]: Read-only list of messages the connected client has cached.
@ -1109,6 +1118,23 @@ class Client:
"""
return self._connection.get_sticker(id)
def get_soundboard_sound(self, id: int, /) -> Optional[SoundboardSound]:
"""Returns a soundboard sound with the given ID.
.. versionadded:: 2.5
Parameters
----------
id: :class:`int`
The ID to search for.
Returns
--------
Optional[:class:`.SoundboardSound`]
The soundboard sound or ``None`` if not found.
"""
return self._connection.get_soundboard_sound(id)
def get_all_channels(self) -> Generator[GuildChannel, None, None]:
"""A generator that retrieves every :class:`.abc.GuildChannel` the client can 'access'.
@ -2964,6 +2990,26 @@ class Client:
data = await self.http.get_sticker_pack(sticker_pack_id)
return StickerPack(state=self._connection, data=data)
async def fetch_soundboard_default_sounds(self) -> List[SoundboardDefaultSound]:
"""|coro|
Retrieves all default soundboard sounds.
.. versionadded:: 2.5
Raises
-------
HTTPException
Retrieving the default soundboard sounds failed.
Returns
---------
List[:class:`.SoundboardDefaultSound`]
All default soundboard sounds.
"""
data = await self.http.get_soundboard_default_sounds()
return [SoundboardDefaultSound(state=self._connection, data=sound) for sound in data]
async def create_dm(self, user: Snowflake) -> DMChannel:
"""|coro|