3030from typing_extensions import override
3131
3232from .asset import Asset
33- from .emoji import GuildEmoji , PartialEmoji , _EmojiTag
33+ from .emoji import PartialEmoji , _EmojiTag
3434from .mixins import Hashable
3535from .types .channel import (
3636 VoiceChannelEffectSendEvent as VoiceChannelEffectSendEventPayload ,
5353class PartialSoundboardSound (Hashable ):
5454 """A partial soundboard sound.
5555
56+ .. versionadded:: 2.7
57+
5658 Attributes
5759 ----------
5860 id: :class:`int`
5961 The sound's ID.
6062 volume: :class:`float`
6163 The sound's volume.
62- emoji: :class:`PartialEmoji`
63- The sound's emoji.
64-
65- .. versionadded:: 2.7
64+ emoji: :class:`PartialEmoji` | :class:`None`
65+ The sound's emoji. Could be ``None`` if the sound has no emoji.
6666 """
6767
6868 __slots__ = ("id" , "volume" , "emoji" , "_http" , "_state" )
@@ -84,11 +84,14 @@ def _from_data(
8484 self .volume = (
8585 float (data .get ("volume" , 0 ) or data .get ("sound_volume" , 0 )) or None
8686 )
87+ self .emoji = None
8788 if raw_emoji := data .get (
8889 "emoji"
8990 ): # From gateway event (VoiceChannelEffectSendEventPayload)
9091 self .emoji = PartialEmoji .from_dict (raw_emoji )
91- else : # From HTTP response (SoundboardSoundPayload)
92+ elif data .get ("emoji_name" ) or data .get (
93+ "emoji_id"
94+ ): # From HTTP response (SoundboardSoundPayload)
9295 self .emoji = PartialEmoji (
9396 name = data .get ("emoji_name" ),
9497 id = int (data .get ("emoji_id" , 0 ) or 0 ) or None ,
@@ -120,25 +123,19 @@ def __repr__(self) -> str:
120123class SoundboardSound (PartialSoundboardSound ):
121124 """Represents a soundboard sound.
122125
126+ .. versionadded:: 2.7
127+
123128 Attributes
124129 ----------
125- id: :class:`int`
126- The sound's ID.
127- volume: :class:`float`
128- The sound's volume.
129130 name: :class:`str`
130131 The sound's name.
131132 available: :class:`bool`
132133 Whether the sound is available. Could be ``False`` if the sound is not available.
133134 This happens for example when the guild lost the boost level required to use the sound.
134- emoji: :class:`PartialEmoji`
135- The sound's emoji.
136135 guild: :class:`Guild` | :class:`None`
137136 The guild the sound belongs to. Could be ``None`` if the sound is a default sound.
138- owner : :class:`User`
137+ user : :class:`User` | :class:`None `
139138 The sound's owner. Could be ``None`` if the sound is a default sound.
140-
141- .. versionadded:: 2.7
142139 """
143140
144141 __slots__ = (
0 commit comments