1
0
mirror of https://github.com/Rapptz/discord.py.git synced 2025-09-19 14:38:43 +00:00
Commit Graph

673 Commits

Author SHA1 Message Date
1c3a5831f9 [lint] Removed unused variable handler
Left over by the removal of handlers in 2721689.
2018-11-24 22:17:58 -05:00
df144b0959 [lint] Changed missed docstrings to raw-string
Missed by a4d1599 despite being pointed out in .
2018-11-24 22:17:58 -05:00
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
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
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
2721689254 Optimise tight loops in DiscordGateway.received_message
* 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
2018-09-24 23:22:49 -04:00
5c24e69cf2 Fix up the Sphinx strings causing warnings. 2018-09-15 09:54:00 -04:00
c8b49d37be [lint] Fix incorrect and inconsistent whitespace
Adjust whitespace to be consistent with the rest of the library.
2018-08-22 21:43:53 -04:00
119c5a0618 [lint] Remove unused variables
Left over from various refactoring and rewrites.
2018-08-22 21:43:51 -04:00
395af228b1 More informations for the Application info
This adds the rpc_origin, bot_public and
bot_require_code_grant attributes
2018-08-22 21:06:09 -04:00
8ccb98d395 Explicitly mark event handlers private 2018-08-09 03:27:39 -04:00
8d39ab8c8c Fix dumb typo in the warning. 2018-07-24 04:48:36 -04:00
12236325f6 Add a warning for self-bots in Client.login
Closes 
2018-07-24 03:48:51 -04:00
Kot
e15452e198 Add clarification about creating guilds 2018-07-24 03:45:28 -04:00
87d9eefdef [docs] discord/client: remove reference to async_event 2018-07-19 21:27:30 -04:00
ec3435b224 Remove remaining asyncio.coroutine calls.
Also remove Client.async_event
2018-07-05 03:45:58 -04:00
c67d95327e Remove dead package references. 2018-06-10 18:16:40 -04:00
f25091efe1 Drop support for Python 3.4 and make minimum version 3.5.2. 2018-06-10 18:10:00 -04:00
0e945915b7 Fixes various documentation errors/inconsistencies
Mostly dealing with permissions, also fixes Raw Events inclusion.
2018-05-18 20:25:54 -04:00
e9916e2844 Convert Client.activity back to an Activity-like object 2018-03-06 18:13:17 -05:00
61c8e35929 Missing import for _ActivityTag inside Client 2018-03-06 09:10:13 -05:00
0fcd385b9a Add ability to change the activity used when logging in at runtime. 2018-03-05 11:23:07 -05:00
f8f8f418f3 Split Game object to separate Activity subtypes for Rich Presences.
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.
2018-03-05 11:15:49 -05:00
3112e1c17e Add intersphinx 2018-01-06 17:23:59 -05:00
e2f7945f59 Proper variable name in Client.clear. 2017-12-20 09:45:09 -05:00
5c5a59c18e Add Client.clear to clear the bot's internal state to a clean slate.
In case you want to have some external restart loop.
2017-12-16 21:36:39 -05:00
13632faf97 Fix AppInfo.id being a string 2017-10-02 13:38:05 -07:00
fd531297d2 Changed discord.Client.event to debug log success instead of info log.
This is suggested to prevent spamming the console unnecesarilly.

Info should be used to output information to the user that is important, but
not a warning or an error. If I am bundling a bot as a modular package then
it doesn't really make sense to spam their console with every time a coroutine
is subscribed to, as it likely will not mean anything to the user. If they are
interested in this, it would make more sense to just to enable debugging first.

I have made this change, as I am writing a wrapper for this library for a
private project, and that will handle dispatching events, thus, I do not
need a prompt for each event that is subscribed to in this module outside of
DEBUG. Currently, with logging set to INFO, I am getting 47 lines reading:

    INFO:discord.client:coroutine has successfully been registered as an event

...being output as my bot starts, and without having to disable INFO logging
altogether, I am currently having to temporarily change the verbosity of the
logger as the events are initialised, which is not desirable as it could
potentially cover up any other INFO messages that would be useful to have
output.

Using a filter seems like a bit of a hacky workaround. If this isn't acceptable
then another alternative would be to add a parameter to the constructor of
discord.Client to enable or disable printing this information.
2017-09-23 12:50:12 +01:00
025136076a Add an example for on_reaction_add waiting.
Apparently people would rather read examples than the actual
documentation.
2017-09-18 05:46:51 -04:00
37b0fdb898 Add webhook support.
Allows for usage of either `requests` and `aiohttp` when used in
"Standalone" mode.

Fixes 
2017-08-21 01:57:07 -04:00
0f7482ed6e Add Client.latency, AutoShardedClient.latency and latencies.
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.
2017-08-15 23:41:11 -04:00
0d21e83b7f Fix the proxy support for aiohttp>=1.4. 2017-08-11 16:44:15 +02:00
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
1582116b72 Add documentation examples for AsyncIterator and change_presence. 2017-08-08 17:31:08 -04:00
ea0c37b538 accept_invite() doesn't exist on rewrite 2017-07-25 06:58:42 -03:00
2e57fa6dfd Don't re-raise in Client.connect if it's a clean close code. 2017-07-14 11:06:00 -04:00
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
25a1d8c300 Add support for user flags in Profile. 2017-06-30 18:49:49 -04:00
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
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
497be35d5f Log when a KeyboardInterrupt is met in Client.run 2017-05-25 21:30:22 -04:00
3436792614 Allow setting a presence upon logging in. 2017-05-20 15:19:47 -04:00
9e24d43c63 Rewrite Client.run yet again.
This time it should definitely fix .
2017-05-20 14:29:33 -04:00
6e2ecbc167 Re-raise exceptions from Client.start in Client.run. 2017-05-20 12:58:29 -04:00
f3eb039c4b Re-implement how Client.run is done by using run_forever instead. 2017-05-20 12:46:26 -04:00
4dfaffd5f2 Only do loop cleanup in finally block when on windows.
Should also fix .
2017-05-20 12:08:02 -04:00
1e1b02c630 Check if we're closing the event loop before using it.
Should fix .
2017-05-20 11:58:29 -04:00
3727618b65 Kill remaining references to discord.Channel in documentation. 2017-05-19 21:58:02 -04:00
df90aaa610 Rename internal ConnectionState attribute to have an underscore.
Some people like to use that variable name apparently.

See  and .
2017-05-16 20:20:39 -04:00
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