|
26 | 26 | from __future__ import annotations
|
27 | 27 |
|
28 | 28 | import datetime
|
29 |
| -from typing import TYPE_CHECKING, Any, Callable, Iterable, Mapping, TypeVar, overload |
| 29 | +from typing import ( |
| 30 | + TYPE_CHECKING, |
| 31 | + Any, |
| 32 | + Callable, |
| 33 | + Iterable, |
| 34 | + Mapping, |
| 35 | + NamedTuple, |
| 36 | + TypeVar, |
| 37 | + overload, |
| 38 | +) |
30 | 39 |
|
31 | 40 | import discord.abc
|
32 | 41 |
|
|
40 | 49 | SortOrder,
|
41 | 50 | StagePrivacyLevel,
|
42 | 51 | VideoQualityMode,
|
| 52 | + VoiceChannelEffectAnimationType, |
43 | 53 | VoiceRegion,
|
44 | 54 | try_enum,
|
45 | 55 | )
|
|
52 | 62 | from .object import Object
|
53 | 63 | from .partial_emoji import PartialEmoji, _EmojiTag
|
54 | 64 | from .permissions import PermissionOverwrite, Permissions
|
| 65 | +from .soundboard import PartialSoundboardSound, SoundboardSound |
55 | 66 | from .stage_instance import StageInstance
|
56 | 67 | from .threads import Thread
|
57 | 68 | from .utils import MISSING
|
|
66 | 77 | "PartialMessageable",
|
67 | 78 | "ForumChannel",
|
68 | 79 | "ForumTag",
|
| 80 | + # "VoiceChannelEffect", |
| 81 | + "VoiceChannelEffectSendEvent", |
69 | 82 | )
|
70 | 83 |
|
71 | 84 | if TYPE_CHECKING:
|
|
84 | 97 | from .types.channel import StageChannel as StageChannelPayload
|
85 | 98 | from .types.channel import TextChannel as TextChannelPayload
|
86 | 99 | from .types.channel import VoiceChannel as VoiceChannelPayload
|
| 100 | + from .types.channel import VoiceChannelEffectSendEvent as VoiceChannelEffectSend |
87 | 101 | from .types.snowflake import SnowflakeList
|
88 | 102 | from .types.threads import ThreadArchiveDuration
|
89 | 103 | from .user import BaseUser, ClientUser, User
|
@@ -3220,6 +3234,79 @@ def get_partial_message(self, message_id: int, /) -> PartialMessage:
|
3220 | 3234 | return PartialMessage(channel=self, id=message_id)
|
3221 | 3235 |
|
3222 | 3236 |
|
| 3237 | +class VoiceChannelEffectAnimation(NamedTuple): |
| 3238 | + id: int |
| 3239 | + type: VoiceChannelEffectAnimationType |
| 3240 | + |
| 3241 | + |
| 3242 | +class VoiceChannelSoundEffect(PartialSoundboardSound): ... |
| 3243 | + |
| 3244 | + |
| 3245 | +class VoiceChannelEffectSendEvent: |
| 3246 | + """Represents the payload for an :func:`on_voice_channel_effect_send` |
| 3247 | +
|
| 3248 | + .. versionadded:: 2.4 |
| 3249 | +
|
| 3250 | + Attributes |
| 3251 | + ---------- |
| 3252 | + animation_type: :class:`int` |
| 3253 | + The type of animation that is being sent. |
| 3254 | + animation_id: :class:`int` |
| 3255 | + The ID of the animation that is being sent. |
| 3256 | + sound: Optional[:class:`SoundboardSound`] |
| 3257 | + The sound that is being sent, might be None if the effect is not a sound effect. |
| 3258 | + guild: :class:`Guild` |
| 3259 | + The guild that the sound is being sent in. |
| 3260 | + user: :class:`Member` |
| 3261 | + The member that is sending the sound. |
| 3262 | + channel: :class:`VoiceChannel` |
| 3263 | + The voice channel that the sound is being sent in. |
| 3264 | + data: :class:`dict` |
| 3265 | + The raw data sent by the gateway([#6025](https://github.com/discord/discord-api-docs/pull/6025)). |
| 3266 | + """ |
| 3267 | + |
| 3268 | + __slots__ = ( |
| 3269 | + "_state", |
| 3270 | + "animation_type", |
| 3271 | + "animation_id", |
| 3272 | + "sound", |
| 3273 | + "guild", |
| 3274 | + "user", |
| 3275 | + "channel", |
| 3276 | + "data", |
| 3277 | + "emoji", |
| 3278 | + ) |
| 3279 | + |
| 3280 | + def __init__( |
| 3281 | + self, |
| 3282 | + data: VoiceChannelEffectSend, |
| 3283 | + state: ConnectionState, |
| 3284 | + sound: SoundboardSound | PartialSoundboardSound | None = None, |
| 3285 | + ) -> None: |
| 3286 | + self._state = state |
| 3287 | + channel_id = int(data["channel_id"]) |
| 3288 | + user_id = int(data["user_id"]) |
| 3289 | + guild_id = int(data["guild_id"]) |
| 3290 | + self.animation_type: VoiceChannelEffectAnimationType = try_enum( |
| 3291 | + VoiceChannelEffectAnimationType, data["animation_type"] |
| 3292 | + ) |
| 3293 | + self.animation_id = int(data["animation_id"]) |
| 3294 | + self.sound = sound |
| 3295 | + self.guild = state._get_guild(guild_id) |
| 3296 | + self.user = self.guild.get_member(user_id) |
| 3297 | + self.channel = self.guild.get_channel(channel_id) |
| 3298 | + self.emoji = ( |
| 3299 | + PartialEmoji( |
| 3300 | + name=data["emoji"]["name"], |
| 3301 | + animated=data["emoji"]["animated"], |
| 3302 | + id=data["emoji"]["id"], |
| 3303 | + ) |
| 3304 | + if data.get("emoji", None) |
| 3305 | + else None |
| 3306 | + ) |
| 3307 | + self.data = data |
| 3308 | + |
| 3309 | + |
3223 | 3310 | def _guild_channel_factory(channel_type: int):
|
3224 | 3311 | value = try_enum(ChannelType, channel_type)
|
3225 | 3312 | if value is ChannelType.text:
|
|
0 commit comments