Sinks¶
Core¶
- class discord.sinks.Filters(**kwargs)[源代码]¶
Filters for
Sink在 2.0 版本加入.
- 参数:
container -- Container of all Filters.
- class discord.sinks.Sink(*, filters=None)[源代码]¶
A sink "stores" recorded audio data.
Can be subclassed for extra customizablilty.
警告
It is recommended you use the officially provided sink classes, such as
WaveSink.just replace the following like so:
vc.start_recording( MySubClassedSink(), finished_callback, ctx.channel, )
在 2.0 版本加入.
- 抛出:
ClientException -- An invalid encoding type was specified.
ClientException -- Audio may only be formatted after recording is finished.
- class discord.sinks.AudioData(file)[源代码]¶
Handles data that's been completely decrypted and decoded and is ready to be saved to file.
在 2.0 版本加入.
- write(data)[源代码]¶
Writes audio data.
- 抛出:
ClientException -- The AudioData is already finished writing.
- cleanup()[源代码]¶
Finishes and cleans up the audio data.
- 抛出:
ClientException -- The AudioData is already finished writing.
- on_format(encoding)[源代码]¶
Called when audio data is formatted.
- 抛出:
ClientException -- The AudioData is still writing.
Sink Classes¶
- class discord.sinks.WaveSink(*, filters=None)[源代码]¶
A special sink for .wav(wave) files.
在 2.0 版本加入.
- format_audio(audio)[源代码]¶
Formats the recorded audio.
- 抛出:
WaveSinkError -- Audio may only be formatted after recording is finished.
WaveSinkError -- Formatting the audio failed.
- class discord.sinks.MP3Sink(*, filters=None)[源代码]¶
A special sink for .mp3 files.
在 2.0 版本加入.
- format_audio(audio)[源代码]¶
Formats the recorded audio.
- 抛出:
MP3SinkError -- Audio may only be formatted after recording is finished.
MP3SinkError -- Formatting the audio failed.
- class discord.sinks.MP4Sink(*, filters=None)[源代码]¶
A special sink for .mp4 files.
在 2.0 版本加入.
- format_audio(audio)[源代码]¶
Formats the recorded audio.
- 抛出:
MP4SinkError -- Audio may only be formatted after recording is finished.
MP4SinkError -- Formatting the audio failed.
- class discord.sinks.M4ASink(*, filters=None)[源代码]¶
A special sink for .m4a files.
在 2.0 版本加入.
- format_audio(audio)[源代码]¶
Formats the recorded audio.
- 抛出:
M4ASinkError -- Audio may only be formatted after recording is finished.
M4ASinkError -- Formatting the audio failed.
- class discord.sinks.MKVSink(*, filters=None)[源代码]¶
A special sink for .mkv files.
在 2.0 版本加入.
- format_audio(audio)[源代码]¶
Formats the recorded audio.
- 抛出:
MKVSinkError -- Audio may only be formatted after recording is finished.
MKVSinkError -- Formatting the audio failed.
- class discord.sinks.MKASink(*, filters=None)[源代码]¶
A special sink for .mka files.
在 2.0 版本加入.
- format_audio(audio)[源代码]¶
Formats the recorded audio.
- 抛出:
MKASinkError -- Audio may only be formatted after recording is finished.
MKASinkError -- Formatting the audio failed.
- class discord.sinks.OGGSink(*, filters=None)[源代码]¶
A special sink for .ogg files.
在 2.0 版本加入.
- format_audio(audio)[源代码]¶
Formats the recorded audio.
- 抛出:
OGGSinkError -- Audio may only be formatted after recording is finished.
OGGSinkError -- Formatting the audio failed.