72 Commits

Author SHA1 Message Date
Rapptz
df90aaa610 Rename internal ConnectionState attribute to have an underscore.
Some people like to use that variable name apparently.

See #568 and #569.
2017-05-16 20:20:39 -04:00
Rapptz
e557f69c83 Make sure that websockets.connect is a coroutine.
In 3.5.0 and 3.5.1 asyncio.ensure_future requires a Future or a
coroutine otherwise a TypeError is raised. The issue is that the
websockets.connect call is an awaitable rather than a coroutine.

asyncio.ensure_future did not gain support for awaitables until 3.5.2.
This patch allows 3.5.0 and 3.5.1 to connect regardless of their python
version.
2017-05-09 20:35:18 -04:00
Rapptz
3cfebc4605 Timeout when doing initial connection. 2017-04-22 02:18:35 -04:00
Rapptz
1fc08bc5a2 Remove unused imports. 2017-04-18 04:22:35 -04:00
Rapptz
d534a0989e Properly cleanup of VoiceClients in cache. 2017-04-18 04:09:33 -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
cadf6960b7 Use create_future wrapper for initially created Future. 2017-04-12 19:55:01 -04:00
Rapptz
ac90159c72 Improve logging in more places.
This shows the Shard ID in more places, along with a gateway trace and
session ID. Also helps show the RESUME/IDENTIFY/RESUMED/READY flow a
bit more instead of it looking like the connection has zombied out.
2017-04-12 19:43:47 -04:00
Rapptz
e5c5695399 Proper recursion when launching shards. 2017-04-07 23:23:48 -04:00
Rapptz
fd62c8a4f1 Aggregate shard closing futures instead of doing them sequentially. 2017-03-21 03:52:24 -04:00
Rapptz
5461bfb475 Check if we're closed before attempting to do a reconnect. 2017-03-21 03:32:09 -04:00
Rapptz
58fa5fdc9a Add experimental reconnection logic. 2017-02-15 19:10:32 -05:00
Rapptz
dc486980f8 Rewrite RESUME logic to be more in line with what is requested.
Apparently we should always try to RESUME first and if we get
INVALIDATE_SESSION then we should IDENTIFY instead. This is the
preferred way to do RESUMEs.
2017-02-08 04:37:16 -05:00
Rapptz
e77012f4d9 Make all public is_ functions into methods instead of properties. 2017-01-29 20:53:17 -05:00
Rapptz
e1aaf74fa7 Add option to disable auto member chunking. 2017-01-23 07:07:42 -05:00
Rapptz
ff9f5749e1 Update copyright year to 2017. 2017-01-20 23:19:19 -05:00
Rapptz
898a05d5ea Fix AutoShardedClient docstring. 2017-01-16 16:37:53 -05:00
Rapptz
93d267cd2b Remove extraneous prints. 2017-01-08 02:08:38 -05:00
Rapptz
92c1637921 Allow overriding the shard_ids used for initial shard launch. 2017-01-08 02:05:21 -05:00
Rapptz
4bc6625739 Add AutoShardedClient.change_presence. 2017-01-08 01:51:10 -05:00
Rapptz
b5bed9ef33 Change the way shards are launched in AutoShardedClient. 2017-01-08 01:31:46 -05:00
Rapptz
20041ea756 Implement AutoShardedClient for transparent sharding.
This allows people to run their >2,500 guild bot in a single process
without the headaches of IPC/RPC or much difficulty.
2017-01-07 23:19:39 -05:00