NCPlayz
3c9bcc2851
Improve documentation
2019-06-07 19:27:46 -04:00
Rapptz
abb9c067cc
Add log line to show if we disconnected normally.
2019-05-01 02:49:52 -04:00
Imayhaveborkedit
7eb8417883
Fix voice handshake race condition
...
In the event that two voice_server_updates are received in a short time frame, the second one is now ignored.
2019-04-10 00:55:52 -04:00
Daniel
3a36f78e08
Use is_connected() instead of _connected in checks
...
Was doing a falsy check on an Event object instead of using the (unused) is_connected() function.
2019-04-09 00:14:41 -04:00
Rapptz
78459f3ed0
Don't reconnect during 4014/4015 in voice websocket.
2019-03-05 19:45:13 -05:00
Imayhaveborkedit
9c5259afd7
Update voice code to vws V4
...
- Update internals to be compatible with v4
- Adds multiple encryption mode support. Previously only `xsalsa20_poly1305` was supported. Now `xsalsa20_poly1305_suffix` is also supported.
Note: There is no (nice) way to manually select a mode. The user needn't worry about this however.
- Fixed speaking state bug. When you disconnected from a voice channel while a bot was playing, upon reconnect you would be unable to hear the bot. This was caused by bots not sending their speaking state while transmitting. Bots will now set their speaking state properly when transmitting.
Note: This does not account for sending actual silence, the speaking indicator will still be active.
2019-01-28 22:22:52 -05:00
Dante Dam
9656a21ebe
Bumped copyright years to 2019.
2019-01-28 22:22:50 -05:00
Hornwitser
efb4ff850e
[lint] Fix import order
...
Reorder imports to be consistenly grouped by standard library, third
party library, and local modules in that order thoughout the library.
2018-11-24 22:17:58 -05:00
Hornwitser
fa46b07db1
[lint] Rename exception variables to exc
...
Use the more explicit (and common) exc instead of e as the variable
holding the exception in except handlers.
2018-11-24 22:17:57 -05:00
Hornwitser
4ae8e81660
[lint] Remove redundant exception variables
...
Use bare raise statement when reraising the exception that occured, and
remove unused exception variables. Also remove a pointless exception
handler in discord.opus.
2018-11-24 22:17:57 -05:00
Hornwitser
a71b3b5fa0
[lint] Limit unneccessarily broad except clauses
...
Add exception qualifier(s) to bare except clauses swallowing exceptions.
2018-11-24 22:17:57 -05:00
Rapptz
5c24e69cf2
Fix up the Sphinx strings causing warnings.
2018-09-15 09:54:00 -04:00
Hornwitser
119c5a0618
[lint] Remove unused variables
...
Left over from various refactoring and rewrites.
2018-08-22 21:43:51 -04:00
Rapptz
f25091efe1
Drop support for Python 3.4 and make minimum version 3.5.2.
2018-06-10 18:10:00 -04:00
Rapptz
a425bd91be
Fix invalid close errors on websockets 4.x
...
Fixes #1110
2018-03-06 00:15:36 -05:00
Tobotimus
3112e1c17e
Add intersphinx
2018-01-06 17:23:59 -05:00
Rapptz
305cc3acfa
Clarify VoiceClient.disconnect docs a little more.
2017-09-16 13:29:36 -04:00
Rapptz
fe3b917564
Continue connection loop with back-off if connecting fails >5 times.
2017-07-25 20:00:00 -04:00
Rapptz
b06899e7d4
Defer logging formatting until the logger is actually called.
...
This would cause unnecessary format calls even if you didn't have
logging enabled.
2017-06-09 18:53:24 -04:00
Rapptz
64d09f3720
Force disconnect in abc.Connectable.connect.
...
Some cases of is_connected is not set so we need to force it to clear
it anyway.
2017-05-13 16:01:32 -04:00
Rapptz
b44bba6ee6
First pass at documentation reform.
2017-05-12 20:14:34 -04:00
Rapptz
663315f7ac
Explicitly close UDP sockets when re-creating them.
...
This does not actually make a big difference since the GC should
technically close them when needed but might as well be more explicit.
2017-05-02 20:25:54 -04:00
Rapptz
f5cfc96aaf
Add PCMVolumeTransformer to augment volume of a PCM stream.
...
This also introduces the idea of replacing the VoiceClient.source on
the fly. Note that this internally pauses and resumes the audio
stream.
2017-04-19 17:23:39 -04:00
Rapptz
07d5328873
Add VoiceClient.is_paused to query pause state.
2017-04-19 16:06:45 -04:00
Rapptz
55e63ed87f
Add VoiceClient.source to get the AudioSource being played.
2017-04-19 01:19:39 -04:00
Rapptz
aa32c384ea
Clean cache when TimeoutError occurs.
2017-04-18 20:13:34 -04:00
Rapptz
f9c2ac9d25
Better handling of VOICE_SERVER_UPDATE.
...
This now sort of respects "Awaiting Endpoint..." waiting. I haven't
actually tested out this case since it's hard to get it. However this
new code does work with the regular connection flow.
2017-04-18 19:05:34 -04:00
Rapptz
3b1b26ffb1
Re-implement voice sending.
...
This is a complete redesign of the old voice code.
A list of major changes is as follows:
* The voice websocket will now automatically reconnect with
exponential back-off just like the regular Client does.
* Removal of the stream player concept.
* Audio now gracefully pauses and resumes when a disconnect is found.
* Introduce a discord.AudioSource concept to abstract streams
* Flatten previous stream player functionality with the
VoiceClient, e.g. player.stop() is now voice_client.stop()
* With the above re-coupling this means you no longer have to
store players anywhere.
* The after function now requires a single parameter, the error,
if any existed. This will typically be None.
A lot of this design is experimental.
2017-04-18 03:49:48 -04:00
Rapptz
132ac45010
Ensure after is called inside the daemon thread for players.
2017-02-14 02:10:07 -05:00
Rapptz
ff9f5749e1
Update copyright year to 2017.
2017-01-20 23:19:19 -05:00
Rapptz
79a49f9145
Absolute import some circular dependencies to appease Python 3.4.
2017-01-03 09:52:02 -05:00
Rapptz
d1d54a468a
Rename Server to Guild everywhere.
2017-01-03 09:51:54 -05:00
Rapptz
6fec17d7d4
Catch Player errors and gracefully stop them.
...
This also introduces the concept of the after function taking a single
parameter, the current player. This is useful for error handling, e.g.
checking Player.error.
Fixes #291
2016-09-25 05:27:35 -04:00
Daniel
e977bddc1f
Add stderr arg to create_ffmpeg_player
2016-07-08 14:48:04 -04:00
Hornwitser
e1f8bdc440
Make PyNaCl optional
2016-06-28 00:58:11 -04:00
Rapptz
102e8aca43
Raise TypeError if "after" parameter is not a callable.
2016-06-20 01:05:28 -04:00
Rapptz
e736554777
Make sure the socket is closed when we call VoiceClient.disconnect
2016-06-14 22:33:25 -04:00
Rapptz
fe5c369fe9
Handle voice websocket closure if it's a successful close.
2016-06-10 21:45:42 -04:00
Jake
41a2b5ed73
Actually read from the voice websocket & fix heartbeat.
...
This change makes it so that the buffer doesn't fill and the voice server drops the socket.
Also, use correct interval for voice websocket heartbeat.
2016-06-05 21:18:36 -07:00
Rapptz
13a9a7520c
Fix ytdl documentation link.
2016-05-27 15:00:50 -04:00
Rapptz
1155a0aaa4
Make Player threads into daemon threads.
2016-05-12 06:06:38 -04:00
Rapptz
3c04ec2af0
Add a way to change the player volume.
2016-05-12 06:06:38 -04:00
Rapptz
339e26275f
Add VoiceClient.move_to for quick switching of voice channels.
2016-05-12 06:06:37 -04:00
Rapptz
2fc496304c
Add libopus DLLs for ease of use.
2016-05-06 12:23:24 -04:00
Rapptz
d9c780b8a8
Working multi-server voice support.
2016-05-01 20:54:13 -04:00
Rapptz
c1b5a52823
Refactor voice websocket into gateway.py
2016-04-27 18:36:24 -04:00
Rapptz
ee4574a5e1
Drop voice packets when it can be potentially blocking.
2016-03-31 23:44:22 -04:00
izy521
719c0269f4
Encrypted audio working with PyNacl
...
I chose PyNacl since it came with its own libsodium portable copy.
2016-03-31 23:03:34 -04:00
Rapptz
827ca1e5a2
Add boolean option to specify if VoiceClient.play_audio should encode.
...
This allows people to send raw opus encoded data instead of being
forced to encode to Opus.
2016-03-25 19:12:59 -04:00
Rapptz
4fa1bcadaa
Add a way to set ffmpeg options before the -i flag.
2016-03-25 18:49:23 -04:00