Skip to content

Commit 973255b

Browse files
committed
feat: enforce voice intents for voice connection
And yes astrea. You can stop bullying me for leaving code in, I removed the return
1 parent 2264be3 commit 973255b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

interactions/models/internal/active_voice_state.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from interactions.client.const import MISSING
1010
from interactions.client.errors import VoiceAlreadyConnected, VoiceConnectionTimeout
1111
from interactions.client.utils import optional
12+
from interactions.models.discord.enums import Intents
1213
from interactions.models.discord.snowflake import Snowflake_Type, to_snowflake
1314
from interactions.models.discord.voice_state import VoiceState
1415

@@ -140,6 +141,9 @@ async def connect(self, timeout: int = 5) -> None:
140141
if self.connected:
141142
raise VoiceAlreadyConnected
142143

144+
if Intents.GUILD_VOICE_STATES not in self._client.intents:
145+
raise RuntimeError("Cannot connect to voice without the GUILD_VOICE_STATES intent.")
146+
143147
tasks = [
144148
asyncio.create_task(
145149
self._client.wait_for("raw_voice_state_update", self._guild_predicate, timeout=timeout)
@@ -154,7 +158,7 @@ async def connect(self, timeout: int = 5) -> None:
154158
self.logger.debug("Waiting for voice connection data...")
155159

156160
try:
157-
self._voice_state, self._voice_server = await asyncio.gather(*tasks, return_exceptions=True) # noqa
161+
self._voice_state, self._voice_server = await asyncio.gather(*tasks) # noqa
158162
except asyncio.TimeoutError:
159163
raise VoiceConnectionTimeout from None
160164

0 commit comments

Comments
 (0)