Rapptz
de65f7309b
Add heartbeat_timeout to the Client options.
...
This setting configures how long before a timeout event is emitted
internally and disconnects the websocket. Since some users were
experiencing issues with the gateway not responding, this should help
mitigate the issue for those with poor PCs.
2017-08-08 21:12:04 -04:00
Gorialis
1582116b72
Add documentation examples for AsyncIterator and change_presence.
2017-08-08 17:31:08 -04:00
Juan
ea0c37b538
accept_invite() doesn't exist on rewrite
2017-07-25 06:58:42 -03:00
Rapptz
2e57fa6dfd
Don't re-raise in Client.connect if it's a clean close code.
2017-07-14 11:06:00 -04:00
Rapptz
3bd0c2120c
Implement a LRU cache for private channels.
...
Another fix related to the discord issue[1].
[1]: https://github.com/hammerandchisel/discord-api-docs/issues/184
2017-07-04 20:02:17 -04:00
Rapptz
25a1d8c300
Add support for user flags in Profile.
2017-06-30 18:49:49 -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
a47ded6e49
Don't expose Client.messages
...
Not entirely sure why it was exposed in the first place. Most uses with
it essentially boiled down to mis-usage when they meant to use the
/messages endpoint (via Client.logs_from or Messageable.history) or
complaining about the partial data woes that came from it.
2017-05-26 07:17:52 -04:00
Rapptz
497be35d5f
Log when a KeyboardInterrupt is met in Client.run
2017-05-25 21:30:22 -04:00
Rapptz
3436792614
Allow setting a presence upon logging in.
2017-05-20 15:19:47 -04:00
Rapptz
9e24d43c63
Rewrite Client.run yet again.
...
This time it should definitely fix #545 .
2017-05-20 14:29:33 -04:00
Rapptz
6e2ecbc167
Re-raise exceptions from Client.start in Client.run.
2017-05-20 12:58:29 -04:00
Rapptz
f3eb039c4b
Re-implement how Client.run is done by using run_forever instead.
2017-05-20 12:46:26 -04:00
Rapptz
4dfaffd5f2
Only do loop cleanup in finally block when on windows.
...
Should also fix #545 .
2017-05-20 12:08:02 -04:00
Rapptz
1e1b02c630
Check if we're closing the event loop before using it.
...
Should fix #545 .
2017-05-20 11:58:29 -04:00
Rapptz
3727618b65
Kill remaining references to discord.Channel in documentation.
2017-05-19 21:58:02 -04:00
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
7a06f0f3bf
Client.get_user_info uses int for IDs not str.
...
Realistically both will work but let's not say that.
2017-05-15 21:31:38 -04:00
Rapptz
1db31d8339
Add back Client.create_guild.
2017-05-09 14:11:13 -04:00
Rapptz
d7153b1b5c
Replace hasattr with try except in chunker.
2017-05-05 21:45:51 -04:00
Rapptz
d24c2a09b6
Change some format usage to use %-formatting.
...
Minor speed increase when we're not doing excessive attribute
access or any type of formatting.
2017-05-04 06:04:55 -04:00
Rapptz
10453d6718
Add Client.get_emoji to get an Emoji from an ID.
2017-04-30 02:53:05 -04:00
Rapptz
1519a6fefa
Fix some linting errors.
2017-04-22 04:50:31 -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
e749b19131
Remove unnecessary shielding.
...
This was causing the exception to be suppressed and print 'NoneType'
instead.
2017-03-25 03:30:49 -04:00
Rapptz
4160cd7d12
Set closed state before actually finishing cleaning up.
2017-03-24 20:40:23 -04:00
Rapptz
9885a946e1
More robust cleanup for Client.run.
...
This should prevent asyncio.CancelledError from being propagated more
and suppressed "Task was destroyed but was pending!" warnings when
doing graceful closes outside of using a KeyboardInterrupt.
To make clean up a bit more robust, also add signal handlers
for POSIX systems.
2017-03-24 20:27:30 -04:00
Rapptz
5461bfb475
Check if we're closed before attempting to do a reconnect.
2017-03-21 03:32:09 -04:00
Rapptz
c90e52450a
Reconnect on any OSError.
2017-03-20 15:45:44 -04:00
Rapptz
df0f1bfbdf
Fix Client inability to shard by actually propagating the shard_id
2017-03-16 05:51:11 -04:00
Rapptz
058f1f13eb
Fix premium key being missing in profile endpoint.
2017-03-13 00:26:43 -04:00
Rapptz
d87d4e716f
Retry on more exceptions in auto reconnect code.
2017-03-07 01:12:28 -05:00
Rapptz
aa41101237
Remove Client.accept_invite
2017-03-04 20:42:21 -05:00
Rapptz
5ce88c8a3f
Reconnect even if we close with 1000 since Discord can send it.
...
Rely on is_closed() instead since this is the true metric of a clean
closure.
2017-03-01 05:10:01 -05:00
Rapptz
9d4f3ebb43
Miscellaneous documentation fixes in Client.wait_for
2017-02-23 22:19:07 -05:00
Rapptz
e16a1e583e
Remove Client.email attribute.
...
Use ClientUser.email instead.
2017-02-23 22:13:45 -05:00
Rapptz
b7488d7c6e
Reconnect when a task times out and propagates.
2017-02-19 17:44:27 -05:00
Rapptz
58fa5fdc9a
Add experimental reconnection logic.
2017-02-15 19:10:32 -05:00
Rapptz
8727472b85
Add Client.get_user_profile to get an arbitrary user's profile.
2017-02-10 17:07:08 -05:00
Rapptz
0dac5e3139
Add Client.emojis to get all emojis.
...
This removes the older get_all_emojis generator.
2017-02-10 16:43:33 -05:00
Rapptz
c16a515e50
Fix NameError in Client.get_invite
2017-02-10 00:22:14 -05:00
Rapptz
274e6af0dd
Fix support for instant invites.
2017-02-08 22:47:52 -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
8c896e9fbc
Re-add Client.wait_until_ready
2017-01-29 20:33:48 -05:00
Rapptz
e5cb7d295c
Replace wait_for_* with a generic Client.wait_for
2017-01-25 22:26:49 -05:00
Rapptz
b876133e87
Add compatibility shim for asyncio.Future creation.
...
Should provide better support for uvloop.
2017-01-25 21:38:50 -05:00