Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ docs/crowdin.py
*.mp3
*.m4a
*.wav
*.pcm
*.png
*.jpg
*.flac
Expand All @@ -18,6 +19,8 @@ docs/crowdin.py
.DS_Store
.python-version
__pycache__
.vs/slnx.sqlite
.vs/*
.vscode/*
env/
build/
test.py
1 change: 1 addition & 0 deletions discord/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
from .sticker import *
from .stage_instance import *
from .interactions import *
from .sink import *
from .components import *
from .threads import *
from .bot import *
Expand Down
16 changes: 15 additions & 1 deletion discord/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
'ExtensionNotLoaded',
'NoEntryPointError',
'ExtensionFailed',
'ExtensionNotFound'
'ExtensionNotFound',
'RecordingException',
)


Expand Down Expand Up @@ -269,6 +270,19 @@ def __init__(self, shard_id: Optional[int]):
)
super().__init__(msg % shard_id)

class RecordingException(ClientException):
"""Exception that's thrown when there is an error while trying to record
audio from a voice channel.

.. versionadded:: 2.0
"""
pass

class SinkException(ClientException):
"""Raised when a Sink error occurs.

.. versionadded:: 2.0
"""

class InteractionResponded(ClientException):
"""Exception that's raised when sending another interaction response using
Expand Down
10 changes: 10 additions & 0 deletions discord/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ def __init__(self, socket, loop, *, hook=None):
self._keep_alive = None
self._close_code = None
self.secret_key = None
self.ssrc_map = {}
if hook:
self._hook = hook

Expand Down Expand Up @@ -839,6 +840,15 @@ async def received_message(self, msg):
self._keep_alive = VoiceKeepAliveHandler(ws=self, interval=min(interval, 5.0))
self._keep_alive.start()

elif op == self.SPEAKING:
ssrc = data['ssrc']
user = int(data['user_id'])
speaking = data['speaking']
if ssrc in self.ssrc_map:
self.ssrc_map[ssrc]['speaking'] = speaking
else:
self.ssrc_map.update({ssrc: {'user_id': user, 'speaking': speaking}})

await self._hook(self, msg)

async def initial_connection(self, data):
Expand Down
Loading