Skip to content

Commit 9702f01

Browse files
authored
Merge branch 'master' into fix/partial-soundboard-sound-eq
2 parents 9fa1f4d + eba89a4 commit 9702f01

2 files changed

Lines changed: 7 additions & 12 deletions

File tree

discord/member.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
from .role import RoleColours
4949
from .types.collectibles import AvatarDecoration
5050
from .user import BaseUser, User, _UserTag
51-
from .utils import MISSING
51+
from .utils import MISSING, utcnow
5252

5353
__all__ = (
5454
"VoiceState",
@@ -821,8 +821,7 @@ def timed_out(self) -> bool:
821821
"""
822822
return (
823823
self.communication_disabled_until is not None
824-
and self.communication_disabled_until
825-
> datetime.datetime.now(datetime.timezone.utc)
824+
and self.communication_disabled_until > utcnow()
826825
)
827826

828827
async def ban(
@@ -1019,8 +1018,9 @@ async def edit(
10191018
else:
10201019
if not suppress:
10211020
voice_state_payload["request_to_speak_timestamp"] = (
1022-
datetime.datetime.utcnow().isoformat()
1021+
utcnow().isoformat()
10231022
)
1023+
10241024
await http.edit_voice_state(guild_id, self.id, voice_state_payload)
10251025

10261026
if voice_channel is not MISSING:
@@ -1121,9 +1121,7 @@ async def timeout_for(
11211121
HTTPException
11221122
An error occurred doing the request.
11231123
"""
1124-
await self.timeout(
1125-
datetime.datetime.now(datetime.timezone.utc) + duration, reason=reason
1126-
)
1124+
await self.timeout(utcnow() + duration, reason=reason)
11271125

11281126
async def remove_timeout(self, *, reason: str | None = None) -> None:
11291127
"""|coro|
@@ -1172,7 +1170,7 @@ async def request_to_speak(self) -> None:
11721170
"""
11731171
payload = {
11741172
"channel_id": self.voice.channel.id,
1175-
"request_to_speak_timestamp": datetime.datetime.utcnow().isoformat(),
1173+
"request_to_speak_timestamp": utcnow().isoformat(),
11761174
}
11771175

11781176
if self._state.self_id != self.id:

discord/state.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,12 +2075,9 @@ def _update_sound(self, sound: SoundboardSound) -> SoundboardSound | None:
20752075
return before
20762076

20772077
def parse_soundboard_sounds(self, data) -> None:
2078-
guild_id = int(data["guild_id"])
20792078
for sound_data in data["soundboard_sounds"]:
20802079
self._add_sound(
2081-
SoundboardSound(
2082-
state=self, http=self.http, data=sound_data, guild_id=guild_id
2083-
)
2080+
SoundboardSound(state=self, http=self.http, data=sound_data)
20842081
)
20852082

20862083
def parse_guild_soundboard_sounds_update(self, data):

0 commit comments

Comments
 (0)