|
48 | 48 | from .role import RoleColours |
49 | 49 | from .types.collectibles import AvatarDecoration |
50 | 50 | from .user import BaseUser, User, _UserTag |
51 | | -from .utils import MISSING |
| 51 | +from .utils import MISSING, utcnow |
52 | 52 |
|
53 | 53 | __all__ = ( |
54 | 54 | "VoiceState", |
@@ -821,8 +821,7 @@ def timed_out(self) -> bool: |
821 | 821 | """ |
822 | 822 | return ( |
823 | 823 | 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() |
826 | 825 | ) |
827 | 826 |
|
828 | 827 | async def ban( |
@@ -1019,8 +1018,9 @@ async def edit( |
1019 | 1018 | else: |
1020 | 1019 | if not suppress: |
1021 | 1020 | voice_state_payload["request_to_speak_timestamp"] = ( |
1022 | | - datetime.datetime.utcnow().isoformat() |
| 1021 | + utcnow().isoformat() |
1023 | 1022 | ) |
| 1023 | + |
1024 | 1024 | await http.edit_voice_state(guild_id, self.id, voice_state_payload) |
1025 | 1025 |
|
1026 | 1026 | if voice_channel is not MISSING: |
@@ -1121,9 +1121,7 @@ async def timeout_for( |
1121 | 1121 | HTTPException |
1122 | 1122 | An error occurred doing the request. |
1123 | 1123 | """ |
1124 | | - await self.timeout( |
1125 | | - datetime.datetime.now(datetime.timezone.utc) + duration, reason=reason |
1126 | | - ) |
| 1124 | + await self.timeout(utcnow() + duration, reason=reason) |
1127 | 1125 |
|
1128 | 1126 | async def remove_timeout(self, *, reason: str | None = None) -> None: |
1129 | 1127 | """|coro| |
@@ -1172,7 +1170,7 @@ async def request_to_speak(self) -> None: |
1172 | 1170 | """ |
1173 | 1171 | payload = { |
1174 | 1172 | "channel_id": self.voice.channel.id, |
1175 | | - "request_to_speak_timestamp": datetime.datetime.utcnow().isoformat(), |
| 1173 | + "request_to_speak_timestamp": utcnow().isoformat(), |
1176 | 1174 | } |
1177 | 1175 |
|
1178 | 1176 | if self._state.self_id != self.id: |
|
0 commit comments