Skip to content

Commit 16677e8

Browse files
committed
🐛 fix PartialSoundboardSound.file
1 parent 2542edc commit 16677e8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

discord/soundboard.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,16 @@ class PartialSoundboardSound(Hashable):
6363
The sound's emoji.
6464
"""
6565

66-
__slots__ = ("id", "volume", "emoji", "_http")
66+
__slots__ = ("id", "volume", "emoji", "_http", "_state")
6767

6868
def __init__(
6969
self,
7070
data: SoundboardSoundPayload | VoiceChannelEffectSendEventPayload,
71+
state: ConnectionState,
7172
http: HTTPClient,
7273
):
7374
self._http = http
75+
self._state = state
7476
self._from_data(data)
7577

7678
def _from_data(
@@ -107,7 +109,7 @@ def __ne__(
107109
@property
108110
def file(self) -> Asset:
109111
""":class:`Asset`: Returns the sound's file."""
110-
return Asset._from_soundboard_sound(self, sound_id=self.id)
112+
return Asset._from_soundboard_sound(self._state, sound_id=self.id)
111113

112114
def __repr__(self) -> str:
113115
return f"<PartialSoundboardSound id={self.id} volume={self.volume} emoji={self.emoji!r}>"
@@ -150,8 +152,7 @@ def __init__(
150152
http: HTTPClient,
151153
data: SoundboardSoundPayload,
152154
) -> None:
153-
self._state = state
154-
super().__init__(data, http)
155+
super().__init__(data, state, http)
155156

156157
@override
157158
def _from_data(

discord/state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,7 @@ def parse_voice_channel_effect_send(self, data) -> None:
20082008
if sound_id := int(data.get("sound_id", 0)):
20092009
sound = self._get_sound(sound_id)
20102010
if sound is None:
2011-
sound = PartialSoundboardSound(data, self.http)
2011+
sound = PartialSoundboardSound(data, self, self.http)
20122012
raw = VoiceChannelEffectSendEvent(data, self, sound)
20132013
else:
20142014
raw = VoiceChannelEffectSendEvent(data, self, None)

0 commit comments

Comments
 (0)