565 Commits

Author SHA1 Message Date
Rapptz
2f7e875a76 Strip tokens before use.
Closes #2135
2019-08-27 04:59:17 -04:00
Rapptz
cf79816c5d Allow disabling the message cache with max_messages=None
This also changes the default to 1000 instead of 5000 since it can
take some time for small bots to cycle through the default and they
make up the majority of it.
2019-08-27 04:50:50 -04:00
Tyler
c7a1f5e6e9 Disambiguate and normalize documentation for non-bot only methods 2019-08-11 18:50:31 -04:00
Rapptz
18fe2035ef Document that the cache retrieval functions require an int ID.
Closes #2285
2019-07-23 04:01:14 -04:00
Tarek
92b3a4f8f4 on_member_leave => on_member_remove 2019-07-18 18:06:42 -04:00
Steve C
7cec42c8f1 Fix doc URL in Client.fetch_guild 2019-07-18 18:06:26 -04:00
Rapptz
f13c1be171 Better knowledge on how guild_subscriptions work now. 2019-07-15 08:01:57 -04:00
Rapptz
ca2ee0655d Add versionadded for guild_subscriptions option. 2019-07-10 05:00:13 -04:00
Rapptz
7b8d50a988 Add support for guild subscriptions. 2019-07-10 04:51:27 -04:00
Rapptz
8f691ae775 Only return exception in Client.run when it's not cancelled. 2019-06-20 23:04:38 -04:00
Rapptz
b2f247bef3 Propagate exception in Client.run
Fix #2237
2019-06-20 23:00:45 -04:00
NCPlayz
dfcf9cdb0a Rename error type for X.fetch_channel(s). 2019-06-12 00:47:42 -04:00
Reece Dunham
34b93c757c docs: Fix minor typo 2019-06-12 00:47:42 -04:00
NCPlayz
3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
NCPlayz
f7c6c5995d Implementing GET '/channels/:id' & '/guilds/:id/channels'
Signed-off-by: NCPlayz <chowdhurynadir0@outlook.com>
2019-06-07 19:12:59 -04:00
Rapptz
82b54933e2 Add asyncio.Task subclass for better __repr__ for events. 2019-05-19 19:17:29 -04:00
NCPlayz
38eb2b4828 Validate kwargs in Client.start 2019-05-19 19:17:27 -04:00
Rapptz
123e151978 Add back signal handling to Client.run
Apparently Python does not transform SIGTERM to KeyboardInterrupt as
nicely as I thought.
2019-05-11 14:40:31 -04:00
Rapptz
de6240f1e7 Rewrite loop cleanup code (again...) and remove signal handling.
This should hopefully be the last time I touch this.
2019-04-26 01:57:33 -04:00
Rapptz
186d9a7f9c Use a regular boolean instead of asyncio.Event for close status. 2019-04-25 01:57:32 -04:00
Rapptz
ceb154718d Add note about overriding Client.close vs Client.logout 2019-04-18 20:04:11 -04:00
khazhyk
b1fae0861a add read-only cached_messages property to Client
For those of us who want access to this sweet trove of zero hop messages
2019-04-17 22:41:59 -04:00
Rapptz
14d66e7b9c Internal consistency with message related HTTPClient methods 2019-04-14 21:05:20 -04:00
Rapptz
50dcdac5ca [commands] Fix references in Bot to actually link.
Exceptions can't seem to link due to a bug in Sphinx.
2019-04-10 05:13:30 -04:00
Vexs
4df0f79a6b Add notes warning that fetch_ methods are api calls
Also recommends using cache attributes/methods instead
2019-04-10 00:55:45 -04:00
Rapptz
e77dec85e9 Fix cleanup code on Linux not working properly. 2019-04-09 00:56:36 -04:00
Rapptz
dcdcf1adac Stop the event loop if it's running during cleanup.
Also handle the coroutine directly instead of using run_until_complete
2019-04-09 00:14:42 -04:00
NCPlayz
7acb7de195 Add notes stating what Guild.fetch_guild and Guild.fetch_guilds returns
Also fixed two typos.
2019-04-08 18:17:40 -04:00
Rapptz
61ee88b0fc Fix oversight where on_disconnect did not get called on WS termination. 2019-04-08 07:45:05 -04:00
Rapptz
72b6152e96 Client.event raises TypeError instead of ClientException. 2019-04-07 22:33:38 -04:00
Rapptz
84c1eac62a Don't raise an exception during the signal handlers. 2019-04-07 16:10:44 -04:00
Rapptz
239d430539 Simplify bot loop cleanup routine.
Attempted solution for #2040
2019-04-06 21:29:57 -04:00
NCPlayz
be227ebcf0 Redesign asset retrieval in the library.
Most assets now return a new class named `Asset`. This allows for the
assets to be consistently saved via a `save` method instead of special
casing for `Attachment`.

`AppInfo` is no longer a namedtuple it is a fully documented dataclass,
as well as having the state attached to it.

Fixes #1997
2019-04-06 19:12:50 -04:00
NCPlayz
8a30a4cac0 Add support for guild widget 2019-03-19 09:22:48 -04:00
NCPlayz
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
NCPlayz
fb02191b80 Organise documentation 2019-03-19 08:24:42 -04:00
Rapptz
963cf4b34e Add on_disconnect event.
I assume this is where it has to be. Fix #1937
2019-03-18 05:29:38 -04:00
NCPlayz
8b8e9a619e Moved http.close to before _closed.set 2019-03-09 14:09:47 +00:00
Rapptz
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
Dante Dam
9656a21ebe Bumped copyright years to 2019. 2019-01-28 22:22:50 -05:00
Rapptz
1f2602d11e Support discordapp.com invite URLs. 2018-11-25 04:54:12 -05:00
SnowyLuma
e89e7dfe93 Add support for multiple activities 2018-11-24 22:36:52 -05:00
Hornwitser
1c3a5831f9 [lint] Removed unused variable handler
Left over by the removal of handlers in 2721689.
2018-11-24 22:17:58 -05:00
Hornwitser
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
Hornwitser
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
Hornwitser
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
Hornwitser
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
Rapptz
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
Rapptz
5c24e69cf2 Fix up the Sphinx strings causing warnings. 2018-09-15 09:54:00 -04:00
Hornwitser
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