Commit Graph

632 Commits

Author SHA1 Message Date
8a30a4cac0 Add support for guild widget 2019-03-19 09:22:48 -04:00
f507f508a2 Expose Metadata
Added access to:
* `/users/@me/guilds`
* `/guilds/{guild_id}`
* `/guilds/{guild_id}/members/{member_id}`

BREAKING CHANGE:
* `get_user_info` -> `fetch_user_info` to match naming scheme.

Remove useless note

Remove `reverse` and corresponding documentation

Update documentation to reflect #1988

Rename `get_` HTTP functions to `fetch_`

Breaking Changes:
* `get_message` -> `fetch_message`
* `get_invite` -> `fetch_invite`
* `get_user_profile` -> `fetch_user_profile`
* `get_webhook_info` -> `fetch_webhook`
* `get_ban` -> `fetch_ban`

Fix InviteConverter, update migrating.rst

Rename get_message to fetch_message
2019-03-19 09:00:18 -04:00
fb02191b80 Organise documentation 2019-03-19 08:24:42 -04:00
963cf4b34e Add on_disconnect event.
I assume this is where it has to be. Fix #1937
2019-03-18 05:29:38 -04:00
8b8e9a619e Moved http.close to before _closed.set 2019-03-09 14:09:47 +00:00
5d78f43e55 Expose more information from partial invites, along with counts.
This adds the following information.

* `PartialInviteGuild` to replace `Object` patching
* `PartialInviteChannel` to replace `Object` patching
* Invite.approximate_member_count and Invite.approximate_presence_count

The new partial objects provide better documentation on what is
expected when you fetch random invites.

Fixes #1830
2019-02-12 20:22:47 -05:00
9656a21ebe Bumped copyright years to 2019. 2019-01-28 22:22:50 -05:00
1f2602d11e Support discordapp.com invite URLs. 2018-11-25 04:54:12 -05:00
e89e7dfe93 Add support for multiple activities 2018-11-24 22:36:52 -05:00
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 #1570.
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 #1449
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 #704
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