678 Commits

Author SHA1 Message Date
Rapptz
bbba8c650f Add missing generic parameters on various Interaction parameters 2023-01-19 07:00:16 -05:00
Rapptz
3c91d2163e Fix overload for on_raw_typing in wait_for 2023-01-17 00:48:29 -05:00
Rapptz
bf860b0b07 Add support for generic ClientT in Interaction 2023-01-16 21:57:54 -05:00
Rapptz
ef7d740524 Add overload for audit_log_entry_create 2023-01-16 20:38:53 -05:00
James Hilton-Balfe
375a001da8
Add overloads for all the events in the event reference
Co-authored-by: Sebastian Law <sebnlaw@gmail.com>
Co-authored-by: Josh <8677174+bijij@users.noreply.github.com>
2023-01-16 20:36:00 -05:00
Eta
4122bef8ee
Fix async iterators requesting past their bounds
This affects Messageable.history, ScheduledEvent.users, 
Client.fetch_guilds, and Guild.audit_logs.

To illustrate the problem, Messageable.history counted returned
messages to tell when to stop iteration, but did so before filtering
away those past the before or after boundaries. When both 
oldest_first=False and an after boundary were provided, this led to the
history iterator continuing to retrieve messages older than the after
boundary, which would then all be filtered away, continuing until the
message limit or the beginning of the entire channel was reached. 

A similar situation would also occur with oldest_first=True and a
before boundary provided.

This commit changes the logic in these methods to count items after
filtering, so they stop requesting more as soon as the in-bounds items
are exhausted.
2022-11-27 01:43:24 -05:00
Steve C
ce06beeb6c
Fix permissions-based docstrings to be more consistent 2022-09-17 14:07:39 -04:00
Ionite
6981eb69c4
Normalize type formatting in TypeError
Normalize most mixed usages of `__class__`, `__class__!r`, 
`__class__.__name__!r` to the standard form of 
`__class__.__name__`
2022-09-12 15:25:55 -04:00
Rapptz
2bf2bfc9b4 Add utils.setup_logging to help set up logging outside of Client.run 2022-08-17 22:53:03 -04:00
Rapptz
7be0779b65 Add root_logger setting to Client.run
This allows people one way to use the colour logger globally
2022-08-16 20:03:02 -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
Puncher
584c22f642
Raise TypeError when token is not a string
Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com>
2022-08-14 05:39:06 -04:00
Rapptz
7da2048d1a Add support for resume_gateway_url 2022-08-10 22:47:27 -04:00
z03h
dc81ff76c4
Add Object.type to Objects where a type can be determined 2022-08-09 08:18:58 -04:00
Rapptz
2d586ae805 Add initial support for app command localisation 2022-08-05 22:35:30 -04:00
Bryan Forbes
d707019348
Bump Pyright to 1.1.265, fix type errors, and remove unnecessary ignores 2022-08-04 22:46:02 -04:00
Rapptz
87bc79e6e3 Change certain sequences to use a special proxy type instead of list
This is to speed up cases where someone is just querying the length
of the underlying sequence. If anything else is done to the sequence
then it is copied from the original iterator.

This change should be mostly transparent.
2022-07-19 01:58:58 -04:00
Rapptz
76402b00f9 Allow configuring the maximum ratelimit timeout before erroring
This is useful for cases where a rate limit is known to be
extraordinarily high, but you still want to handle the error.
This is common with routes such as emoji creation.
2022-07-19 01:36:18 -04:00
Rapptz
53685b9b86 Change stderr prints to use the logging module instead 2022-06-13 01:06:15 -04:00
Rapptz
49e683541b Add default logging configuration when using Client.run
While it is possible to do this type of your set up yourself, it's
better for beginners to have logging automatically set up for them.
This has come up often in the help channel over the years. This also
provides an escape hatch to disable it.
2022-06-13 00:30:13 -04:00
James Hilton-Balfe
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
Rapptz
d19faa5f32 Raise an exception when wait_until_ready is called without a loop 2022-06-11 20:29:55 -04:00
Rapptz
ee71366f72 Fetch application_info on login
This allows users to no longer pass application_id when calling sync
inside setup_hook
2022-05-22 19:52:50 -04:00
Rapptz
1df3ed861c Fix broken HTTPClient.recreate code to actually clear session 2022-05-05 11:42:50 -04:00
Rapptz
4733a499a5 Fix documentation build for Client.get_partial_messageable 2022-05-03 11:02:12 -04:00
Rapptz
c22b6dc2cd Add guild property to DMChannel, GroupChannel, and PartialMessageable
This improves generic duck typing programming by allowing narrowing
the types by just checking for a None guild attribute.
2022-05-03 10:55:29 -04:00
Rapptz
8699d2139a Improve generic duck type programming with PartialMessageable
This adds jump_url, permissions_for, and created_at. Luckily, most
cases of this type being constructed already have the guild_id at
creation time.
2022-05-03 10:49:52 -04:00
Lilly Rose Berner
2dbf14bb72
Separately delay ready event for each shard 2022-04-25 02:01:46 -04:00
Lilly Rose Berner
08844985cc
Fix Client.fetch_guilds not working correctly, increase default limit 2022-04-22 22:31:33 -04:00
Rapptz
987235d564 Only call async setup if the loop sentinel hasn't been changed 2022-04-19 04:27:52 -04:00
Rapptz
76cc2c2272 Require passing intents to Client and its subclasses 2022-04-05 22:32:14 -04:00
Puncher
18050aecd7
Fix broken code blocks in docstrings 2022-04-02 17:57:33 -04:00
jack1142
5ffa3e85de
Update comments after # type: ignore to be compatible with PEP 484 2022-03-27 22:26:34 -04:00
Bryan Forbes
062f4d6f87
Change some methods to use positional-only marker
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
2022-03-22 18:52:25 -04:00
will
13d19dc5ce
Fix typo in http_trace parameter documentation 2022-03-18 10:49:24 -04:00
Rapptz
77ec49782a Add http_trace option in Client to trace the library's HTTP requests 2022-03-18 08:02:53 -04:00
Rapptz
f5341a1cfa Document cases where setup_hook can deadlock rather than raising 2022-03-17 09:56:25 -04:00
apple502j
3e77a7b29e
Forbid wait_until_ready inside setup_hook 2022-03-17 07:25:10 -04:00
Rapptz
c77bbc4dcf Move with_counts parameter documentation where it belongs 2022-03-16 07:43:31 -04:00
Rapptz
7c0a9e901d Fully initialise asyncio state in __aenter__ 2022-03-16 05:51:25 -04:00
Rapptz
575eacb1bf Change loop sentinel error to not use a tuple
This was an unintentional error
2022-03-16 05:50:28 -04:00
Rapptz
2bf612cd67 Fix Client.close erroring if done before proper async initialisation 2022-03-15 06:51:19 -04:00
Rapptz
9b77331603 Change loop sentinel to provide a more descriptive error message
This way people don't think it's a bug. I imagine some people won't
read it, but at least when you point it out they might get it.
2022-03-14 05:52:35 -04:00
Stocker
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
Rapptz
c02a3c0bb2 Add asynchronous context manager support for Client 2022-03-13 05:04:55 -04:00
Han Seung Min - 한승민
93af158b0c
Refactor loop code to allow usage of asyncio.run 2022-03-13 04:54:14 -04:00
Gnome!
68b7ee6b99
Add Client.setup_hook 2022-03-12 09:39:43 -05:00
chromacoat dreamkey
095aaa9ad1
Change wording of InvalidArgument removal in docs 2022-03-11 23:25:43 -05:00