565 Commits

Author SHA1 Message Date
Hornwitser
119c5a0618 [lint] Remove unused variables
Left over from various refactoring and rewrites.
2018-08-22 21:43:51 -04:00
El Laggron
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
Rapptz
8ccb98d395 Explicitly mark event handlers private 2018-08-09 03:27:39 -04:00
Rapptz
8d39ab8c8c Fix dumb typo in the warning. 2018-07-24 04:48:36 -04:00
Rapptz
12236325f6 Add a warning for self-bots in Client.login
Closes #1449
2018-07-24 03:48:51 -04:00
Kot
e15452e198 Add clarification about creating guilds 2018-07-24 03:45:28 -04:00
bmintz
87d9eefdef [docs] discord/client: remove reference to async_event 2018-07-19 21:27:30 -04:00
bmintz
ec3435b224 Remove remaining asyncio.coroutine calls.
Also remove Client.async_event
2018-07-05 03:45:58 -04:00
Rapptz
c67d95327e Remove dead package references. 2018-06-10 18:16:40 -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
Steve C
0e945915b7 Fixes various documentation errors/inconsistencies
Mostly dealing with permissions, also fixes Raw Events inclusion.
2018-05-18 20:25:54 -04:00
Rapptz
e9916e2844 Convert Client.activity back to an Activity-like object 2018-03-06 18:13:17 -05:00
Rapptz
61c8e35929 Missing import for _ActivityTag inside Client 2018-03-06 09:10:13 -05:00
Rapptz
0fcd385b9a Add ability to change the activity used when logging in at runtime. 2018-03-05 11:23:07 -05:00
Rapptz
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
Tobotimus
3112e1c17e Add intersphinx 2018-01-06 17:23:59 -05:00
Rapptz
e2f7945f59 Proper variable name in Client.clear. 2017-12-20 09:45:09 -05:00
Rapptz
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
ReinaSakuraba
13632faf97 Fix AppInfo.id being a string 2017-10-02 13:38:05 -07:00
espeonofespeonage
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
Rapptz
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
Rapptz
37b0fdb898 Add webhook support.
Allows for usage of either `requests` and `aiohttp` when used in
"Standalone" mode.

Fixes #704
2017-08-21 01:57:07 -04:00
Rapptz
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
PapyrusThePlant
0d21e83b7f Fix the proxy support for aiohttp>=1.4. 2017-08-11 16:44:15 +02:00
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