aboutsummaryrefslogtreecommitdiff
path: root/discord/gateway.py
Commit message (Collapse)AuthorAgeFilesLines
* [lint] Fix import orderHornwitser2018-11-241-6/+8
| | | | | Reorder imports to be consistenly grouped by standard library, third party library, and local modules in that order thoughout the library.
* [lint] Do log formating lazilyHornwitser2018-11-241-2/+2
| | | | | Convert log("fmt" % args) to log("fmt", args) as the latter is lazy and does not do the formating if the string is never logged.
* [lint] Remove redundant paranthesisHornwitser2018-11-241-1/+1
| | | | | Remove redundant parenthisis around await expressions. Left over from f25091ef.
* [lint] Replace equality comparisons to singletonsHornwitser2018-11-241-1/+1
| | | | | | | | Restrict the values accepted by comparisons with booleans to be actual booleans. Minor breaking of undocumented behaviour in permissions; the value to set bits to must be booleans (as indicated by the type error thrown).
* [lint] Rename exception variables to excHornwitser2018-11-241-14/+14
| | | | | Use the more explicit (and common) exc instead of e as the variable holding the exception in except handlers.
* [lint] Limit unneccessarily broad except clausesHornwitser2018-11-241-1/+1
| | | | Add exception qualifier(s) to bare except clauses swallowing exceptions.
* Optimise tight loops in DiscordGateway.received_messageRapptz2018-09-241-34/+34
| | | | | | * type(x) is y is faster than isinstance(x, y) * Re-arrange if-statements for common statements * Drop handler getattr for most events that don't use it
* Fix latency being able to be negativeorlnub1232018-08-241-6/+9
|
* Fix send_as_json not dispatching socket_raw_sendorlnub1232018-08-231-1/+1
|
* [lint] Replace deprecated Logger function warnHornwitser2018-08-221-1/+1
| | | | | | | The method log of Logger has never been documented as being a part of the standard logging module. It was renamed to warning when the module was included in the standard library, but the old name was kept for backward compatibility.
* [lint] Fix incorrect and inconsistent whitespaceHornwitser2018-08-221-5/+3
| | | | Adjust whitespace to be consistent with the rest of the library.
* [lint] Remove unused importsHornwitser2018-08-221-1/+1
| | | | Left over from various refactoring and rewrites.
* Disable compression for websockets.Rapptz2018-06-101-2/+2
| | | | Increase of RAM and CPU doesn't give me much benefit I feel.
* Remove dead package references.Rapptz2018-06-101-1/+1
|
* Drop support for Python 3.4 and make minimum version 3.5.2.Rapptz2018-06-101-87/+65
|
* Fix invalid close errors on websockets 4.xRapptz2018-03-061-1/+1
| | | | Fixes #1110
* Split Game object to separate Activity subtypes for Rich Presences.Rapptz2018-03-051-9/+9
| | | | | | | | | | | This is a massive breaking change. * All references to "game" have been renamed to "activity" * Activity objects contain a majority of the rich presence information * Game and Streaming are subtypes for memory optimisation purposes for the more common cases. * Introduce a more specialised read-only type, Spotify, for the official Spotify integration to make it easier to use.
* Fix websockets 4.0 supportBeatButton2018-02-121-4/+4
|
* Add intersphinxTobotimus2018-01-061-1/+1
|
* Reimplement zlib streaming.Rapptz2017-10-141-2/+13
| | | | | | | | | | | | | | This time with less bugs. It turned out that the crash was due to a synchronisation issue between the pending reads and the actual shard polling mechanism. Essentially the pending reads would be cancelled via a simple bool but there would still be a pass left and thus we would have a single pending read left before or after running the polling mechanism and this would cause a race condition. Now the pending read mechanism is properly waited for before returning control back to the caller.
* Revert "Implement zlib streaming for the gateway."Rapptz2017-10-141-14/+2
| | | | This reverts commit 462191a08b5b2efb83f5bc32935dc546d35a744b.
* Implement zlib streaming for the gateway.Rapptz2017-10-121-2/+14
|
* Use time.monotonic instead of time.time for heartbeat code.Rapptz2017-08-191-5/+5
|
* Add Client.latency, AutoShardedClient.latency and latencies.Rapptz2017-08-151-0/+2
| | | | | | This should allow an easier way to query the Discord protocol gateway latency, defined by the difference HEARTBEAT_ACK between and the last sent HEARTBEAT.
* Add heartbeat_timeout to the Client options.Rapptz2017-08-081-1/+4
| | | | | | | 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.
* Add DiscordWebSocket.latency to measure discord heartbeat latency.Rapptz2017-08-081-0/+9
|
* Fix missing lazy logging format calls.Rapptz2017-06-241-5/+5
| | | | Not sure how I missed these.
* Defer logging formatting until the logger is actually called.Rapptz2017-06-091-5/+5
| | | | | This would cause unnecessary format calls even if you didn't have logging enabled.
* Allow setting a presence upon logging in.Rapptz2017-05-201-0/+9
|
* Rename internal ConnectionState attribute to have an underscore.Rapptz2017-05-161-3/+3
| | | | | | Some people like to use that variable name apparently. See #568 and #569.
* Wait 5 seconds before attempting to RESUME during INVALIDATE_SESSION.Rapptz2017-04-221-0/+1
|
* Timeout when doing initial connection.Rapptz2017-04-221-1/+1
|
* Remove unused imports.Rapptz2017-04-181-4/+2
|
* Re-implement voice sending.Rapptz2017-04-181-22/+56
| | | | | | | | | | | | | | | | | | | | 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.
* Improve logging in more places.Rapptz2017-04-121-10/+17
| | | | | | 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.
* Add info logging for close codes we cannot handle.Rapptz2017-02-241-0/+1
|
* Don't RESUME when given sharding related close codes.Rapptz2017-02-151-1/+1
|
* Add missing continue statement in gateway futures.Rapptz2017-02-081-0/+1
|
* Handle HEARTBEAT_ACKRapptz2017-02-081-2/+24
|
* Rewrite RESUME logic to be more in line with what is requested.Rapptz2017-02-081-12/+7
| | | | | | 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.
* Add compatibility shim for asyncio.Future creation.Rapptz2017-01-251-1/+1
| | | | Should provide better support for uvloop.
* Update copyright year to 2017.Rapptz2017-01-201-1/+1
|
* Add AutoShardedClient.change_presence.Rapptz2017-01-081-16/+1
|
* Change the way shards are launched in AutoShardedClient.Rapptz2017-01-081-29/+0
|
* Implement AutoShardedClient for transparent sharding.Rapptz2017-01-071-23/+57
| | | | | This allows people to run their >2,500 guild bot in a single process without the headaches of IPC/RPC or much difficulty.
* Move message creation to a factory method inside ConnectionState.Rapptz2017-01-031-7/+5
|
* Absolute import some circular dependencies to appease Python 3.4.Rapptz2017-01-031-5/+8
|
* Rename Server to Guild everywhere.Rapptz2017-01-031-6/+6
|
* Discard null sequences in the gateway.Rapptz2016-12-161-4/+4
| | | | | This was forbidding the Discord gateway from allowing us to RESUME properly, causing an over-abundance of READY being called.
* Fix typo in change_presence validation messagekhazhyk2016-10-151-1/+1
|