Skip to content

Commit e9c10d8

Browse files
committed
fix: some things
1 parent c8bc1c5 commit e9c10d8

File tree

6 files changed

+88
-16
lines changed

6 files changed

+88
-16
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ docs/crowdin.py
1010
*.mp3
1111
*.m4a
1212
*.wav
13+
*.mp4
14+
*.ogg
1315
*.pcm
1416
*.png
1517
*.jpg

discord/errors.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
'NoEntryPointError',
6161
'ExtensionFailed',
6262
'ExtensionNotFound',
63-
'RecordingException',
6463
)
6564

6665

discord/sinks/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def wait_and_stop(self):
8585
time.sleep(self.seconds)
8686
if self.finished:
8787
return
88-
self.vc.stop_listening()
88+
self.vc.stop_recording()
8989

9090

9191
class RawData:

discord/sinks/errors.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@
2626

2727
class SinkException(DiscordException):
2828
"""Raised when a Sink error occurs.
29+
2930
.. versionadded:: 2.1
3031
"""
3132

3233

3334
class RecordingException(SinkException):
3435
"""Exception that's thrown when there is an error while trying to record
3536
audio from a voice channel.
37+
3638
.. versionadded:: 2.1
3739
"""
3840

@@ -41,34 +43,46 @@ class RecordingException(SinkException):
4143

4244
class MP3SinkError(SinkException):
4345
"""Exception thrown when a exception occurs with :class:`MP3Sink`
46+
4447
.. versionadded:: 2.1
4548
"""
4649

4750

4851
class MP4SinkError(SinkException):
4952
"""Exception thrown when a exception occurs with :class:`MP4Sink`
53+
5054
.. versionadded:: 2.1
5155
"""
5256

5357

5458
class OGGSinkError(SinkException):
5559
"""Exception thrown when a exception occurs with :class:`OGGSink`
60+
5661
.. versionadded:: 2.1
5762
"""
5863

5964

6065
class MKVSinkError(SinkException):
6166
"""Exception thrown when a exception occurs with :class:`MKVSink`
67+
6268
.. versionadded:: 2.1
6369
"""
6470

6571

6672
class WaveSinkError(SinkException):
6773
"""Exception thrown when a exception occurs with :class:`WaveSink`
74+
6875
.. versionadded:: 2.1
6976
"""
7077

7178
class M4ASinkError(SinkException):
7279
"""Exception thrown when a exception occurs with :class:`M4ASink`
80+
81+
.. versionadded:: 2.1
82+
"""
83+
84+
class MKASinkError(SinkException):
85+
"""Exception thrown when a exception occurs with :class:`MKAsSink`
86+
7387
.. versionadded:: 2.1
7488
"""

discord/voice_client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@
5252
from . import opus, utils
5353
from .backoff import ExponentialBackoff
5454
from .gateway import *
55-
from .errors import ClientException, ConnectionClosed, RecordingException
55+
from .errors import ClientException, ConnectionClosed
5656
from .player import AudioPlayer, AudioSource
57-
from .sinks import Sink, RawData
57+
from .sinks import Sink, RawData, RecordingException
5858

5959
from .utils import MISSING
6060

@@ -704,13 +704,13 @@ def unpack_audio(self, data):
704704

705705
self.decoder.decode(data)
706706

707-
def listen(self, sink, callback, *args):
707+
def start_recording(self, sink, callback, *args):
708708
"""The bot will begin recording audio from the current voice channel it is in.
709709
This function uses a thread so the current code line will not be stopped.
710710
Must be in a voice channel to use.
711711
Must not be already recording.
712712
713-
.. versionadded:: 2.0
713+
.. versionadded:: 2.1
714714
715715
Parameters
716716
----------
@@ -754,12 +754,12 @@ def listen(self, sink, callback, *args):
754754
)
755755
t.start()
756756

757-
def stop_listening(self):
757+
def stop_recording(self):
758758
"""Stops the recording.
759759
Must be already recording.
760760
Raises
761761
762-
.. versionadded:: 2.0
762+
.. versionadded:: 2.1
763763
764764
------
765765
RecordingException
@@ -811,7 +811,7 @@ def recv_audio(self, sink, callback, *args):
811811
try:
812812
data = self.socket.recv(4096)
813813
except OSError:
814-
self.stop_listening()
814+
self.stop_recording()
815815
continue
816816

817817
self.unpack_audio(data)

docs/api.rst

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4592,24 +4592,81 @@ Select
45924592

45934593
.. autofunction:: discord.ui.select
45944594

4595-
Voice Recording
4596-
---------------
4595+
Sink Core
4596+
---------
4597+
4598+
.. autoclass:: discord.sinks.Filters
4599+
:members:
4600+
4601+
.. autoclass:: discord.sinks.Sink
4602+
:members:
4603+
4604+
.. autoclass:: discord.sinks.AudioData
4605+
:members:
4606+
4607+
.. autoclass:: discord.sinks.RawData
4608+
:members:
4609+
4610+
4611+
Sinks
4612+
-----
4613+
4614+
.. autoclass:: discord.sinks.WaveSink
4615+
:members:
4616+
4617+
.. autoclass:: discord.sinks.MP3Sink
4618+
:members:
45974619

4598-
.. attributetable:: discord.sink
4620+
.. autoclass:: discord.sinks.MP4Sink
4621+
:members:
45994622

4600-
.. autoclass:: discord.sink.Filters
4623+
.. autoclass:: discord.sinks.M4ASink
46014624
:members:
46024625

4603-
.. autoclass:: discord.sink.Sink
4626+
.. autoclass:: discord.sinks.MKVSink
46044627
:members:
46054628

4606-
.. autoclass:: discord.sink.AudioData
4629+
.. autoclass:: discord.sinks.MKASink
46074630
:members:
46084631

4609-
.. autoclass:: discord.sink.RawData
4632+
.. autoclass:: discord.sinks.OGGSink
46104633
:members:
46114634

46124635

4636+
Sink Error Reference
4637+
--------------------
4638+
4639+
.. autoexception:: discord.sinks.WaveSinkError
4640+
4641+
.. autoexception:: discord.sinks.MP3SinkError
4642+
4643+
.. autoexception:: discord.sinks.MP4SinkError
4644+
4645+
.. autoexception:: discord.sinks.M4ASinkError
4646+
4647+
.. autoexception:: discord.sinks.MKVSinkError
4648+
4649+
.. autoexception:: discord.sinks.MKASinkError
4650+
4651+
.. autoexception:: discord.sinks.OGGSinkError
4652+
4653+
Sink Exception Hierarchy
4654+
~~~~~~~~~~~~~~~~~~~~~~~~
4655+
4656+
.. exception_hierarchy::
4657+
4658+
- :exc:`DiscordException`
4659+
- :exc:`SinkException`
4660+
- :exc:`RecordingException`
4661+
- :exc:`WaveSinkError`
4662+
- :exc:`MP3SinkError`
4663+
- :exc:`MP4SinkError`
4664+
- :exc:`M4ASinkError`
4665+
- :exc:`MKVSinkError`
4666+
- :exc:`MKASinkError`
4667+
- :exc:`OGGSinkError`
4668+
4669+
46134670
Exceptions
46144671
------------
46154672

0 commit comments

Comments
 (0)