Commit Graph
120 Commits
Author SHA1 Message Date
Evanroby 97871a1b96 Fix typos in api reference docs 2026-07-09 19:11:19 -04:00
Jakub Kuczys 108e9abb52 Avoid AttributeError on AutoShardedClient.close() call before async setup 2026-03-04 16:01:50 -05:00
Rapptz 44a44e938f Reformat entire project with ruff instead of black 2025-08-18 20:16:10 -04:00
Soheab 983a9b8f94 Use Unpack where it's possible 2025-08-15 05:36:36 -04:00
Maxine 3e48119654 Fix unreachable code not triggering privileged intent error 2025-06-20 14:24:55 -04:00
DA344 6214942f86 Fix SessionStartLimits and SKU.subscriptions docstrings 2025-01-15 18:22:04 -05:00
Michael H 9806aeb831 Add public method to get session start limits 2024-12-01 16:19:09 -05:00
Michael H 88f62d85d2 Ensure Client.close() has finished in __aexit__
This wraps the closing behavior in a task. Subsequent callers of
.close() now await that same close finishing rather than short
circuiting. This prevents a user-called close outside of __aexit__ from
not finishing before no longer having a running event loop.
2024-05-04 23:20:36 -04:00
Rapptz cb3ea9b889 Add shard_connect_timeout parameter for AutoShardedClient 2024-01-07 19:45:29 -05:00
Rapptz ca5cbcbdf3 Reconnect a shard if disconnected during a HELLO OP 2023-08-01 18:16:11 -04:00
Rapptz 8aaeb6acfa Parse gateway URL as an actual URL using yarl
Discord has changed the URL format to make it infeasible to edit it
using basic string interpolation.
2022-09-17 22:51:23 -04:00
Rapptz 3802780f77 Change a lot of logging INFO calls to be less verbose
Some of the logs were only useful for debug scenarios, so they have
been downgraded to DEBUG. Others were in INFO but supposed to be in
WARNING so those were upgraded.
2022-08-15 10:21:36 -04:00
Rapptz 7da2048d1a Add support for resume_gateway_url 2022-08-10 22:47:27 -04:00
Rapptz 2d586ae805 Add initial support for app command localisation 2022-08-05 22:35:30 -04:00
Rapptz b917904c1b Prevent launching shards when bot is closed
Fix #8210
2022-07-06 05:54:18 -04:00
Rapptz 768242b00e Fix typo in async with documentation 2022-06-12 16:49:33 -04:00
James Hilton-BalfeandRapptz 5d1b63bfee [docs] Add async with documentation for Client
Co-authored-by: Rapptz <1695103+Rapptz@users.noreply.github.com>
2022-06-12 16:06:44 -04:00
Lilly Rose Berner 2dbf14bb72 Separately delay ready event for each shard 2022-04-25 02:01:46 -04:00
Rapptz 76cc2c2272 Require passing intents to Client and its subclasses 2022-04-05 22:32:14 -04:00
Kellen 4fd2d5fdfd Remove redundant imports and variables 2022-03-29 02:50:34 -04:00
5aa696ccfa Fix typing issues and improve typing completeness across the library
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
Co-authored-by: Josh <josh.ja.butt@gmail.com>
2022-03-13 23:52:10 -04:00
Rapptz 9c61e10a55 Move all async object creation to a proper initialisation point
This should make it so no object is created with another loop
2022-03-13 08:33:25 -04:00
Rapptz 8d4f08a5e7 Fix AutoShardedClient to work with the new asyncio loop machinery
Fix #7675
2022-03-13 08:05:44 -04:00
Han Seung Min - 한승민 93af158b0c Refactor loop code to allow usage of asyncio.run 2022-03-13 04:54:14 -04:00
chromacoat dreamkey 095aaa9ad1 Change wording of InvalidArgument removal in docs 2022-03-11 23:25:43 -05:00
Rapptz f7315573aa Remove generic from Interaction and ConnectionState
This results in poor ergonomics due to the lack of default generics
for the common case. For most users this ends up in a degraded
experience since the type will resolve to Unknown rather than at the
very least a Client.
2022-03-05 05:03:23 -05:00
Rapptz f435d160dd Add Interaction.client property 2022-03-01 08:11:22 -05:00
Josh 147948af9b Use typing.Self throughout library 2022-03-01 07:53:24 -05:00
Josh 2b69b5d545 Remove discord.InvalidArgument
This uses TypeError and ValueError instead.
2022-02-26 01:44:49 -05:00
Josh a315786869 Handle type-errors in upcoming pyright release 2022-02-22 08:51:11 -05:00
jack1142 dc19c6c7d5 Add positional-only arguments in more places 2022-02-19 20:28:01 -05:00
Rapptz 1b5c206279 Fix broken rename from pyright 2021-08-22 03:05:22 -04:00
Rapptz ea2d972666 Make global log variable in modules private 2021-08-22 02:33:51 -04:00
Rapptz 8d80259a80 Reformat shard.py 2021-08-21 14:53:19 -04:00
Stocker 5390caa67d Typehint shard.py 2021-08-20 20:05:02 -04:00
Aaron Hennessey 15eb3d2e5d Remove afk parameter from change_presence 2021-07-21 02:45:57 -04:00
Rapptz a8da7d03b9 Remove AutoShardedClient.request_offline_members 2021-04-12 05:28:18 -04:00
Nadir Chowdhury 89456022cf Add __all__ to remaining modules 2021-04-07 02:30:32 -04:00
Rapptz 54288879e2 Remove userbot functionality
This has a lot of legacy and cruft so there may be some stuff I've
missed but this first pass is enough to get a clear separation.
2021-04-04 10:15:30 -04:00
Rapptz 9d39b135f4 Modernize code to use f-strings
This also removes the encoding on the top, since Python 3 does it by
default. It also changes some methods to use `yield from`.
2021-04-04 07:03:53 -04:00
Nadir Chowdhury 63ec23bac2 Code optimisations and refactoring via Sourcery 2021-02-24 21:26:51 -05:00
Nihaal Sangha 69bdc3a184 Change copyright year to present 2021-01-15 05:28:11 -05:00
Rapptz 12d0ae71df Add a way to check if the websocket is rate limited.
This is mainly for low level decision making for utilities that need
to know whether to fetch a member by HTTP or to query through the
websocket.

The library already does this trick in some places so it's only fair
that end users possess the same ability as well.
2020-11-26 04:43:15 -05:00
Rapptz 005a80303f Add chunk_guilds_at_startup and deprecate fetch_offline_members 2020-09-24 01:17:04 -04:00
Rapptz bf8ca58996 Add a special exception for required privileged intents 2020-09-23 03:21:20 -04:00
Rapptz cb8cb557f5 Add Guild.chunk and deprecated Client.request_offline_members 2020-09-23 03:21:19 -04:00
Rapptz 055fe76241 Fix Client.request_offline_members no longer working 2020-09-23 03:21:19 -04:00
Rapptz 0b93fa3a82 Implement VoiceProtocol lower level hooks.
This allows changing the connect flow and taking control of it without
relying on internal events or tricks.
2020-09-23 03:20:35 -04:00
Rapptz 4ccd9c1591 Remove caching from AutoShardedClient.shards 2020-09-10 05:17:25 -04:00
Rapptz 50f4c31d31 Terminate shard processing queue when a clean close is encountered.
Fix #5180
2020-08-01 19:26:49 -04:00