Commit Graph
2872 Commits
Author SHA1 Message Date
Rapptz f8999b63ae Fix long-standing issue with user updates not dispatching properly.
This fix is long coming. For a long time due to the addition of a
global user cache, the on_member_update event would only have the
updated user in the very first dispatch due to a quirk in the reference
only being updated once.

In order to fix this issue two things had to change:

1. There had to be a new event, `on_user_update` to complement
   the equivalent member event.
2. Unnecessary copies of User had to be removed to compensate for the
   performance hit from the diffing.

While doing these two fixes I also re-evaluated some more unnecessary
copies done during the PRESENCE_UPDATE to add member case while
fetch_offline_members=False is set or due to chunking issues. The
number of copies was brought down from 2 to 1, discounting the original
Member creation. Unsure on the benefits of this one, however.

N.B: this doesn't change the pre-existing behaviour of on_member_update
2019-04-08 07:45:04 -04:00
Rapptz 1a9726087a GUILD_MEMBER_UPDATE no longer does actual user updates.
This had been delegated to PRESENCE_UPDATE a long time ago,
unfortunately.
2019-04-08 06:34:28 -04:00
Rapptz c9fd092476 Don't use an enum when unnecessary in Member._client_status 2019-04-08 04:06:01 -04:00
Rapptz c904e4f25b Add a note to load_opus that it's auto loaded on Windows. 2019-04-08 02:34:26 -04:00
Rapptz 1243298b34 Add some version guarantees to the documentation. 2019-04-08 02:18:48 -04:00
khazhyk 7845bfb79b terminate iterators immediately once out of data
if len(data) < 100, either limit was less than 100, or we ran
out of results, in both cases, we should terminate the lookup.

This fixes, e.g., hangs in audit_logs(limit=999999), and will
reduce the number of fetch calls for any case where limit is
greater than the number of results. (Prior, would just kinda
loop calling audit-logs)
2019-04-07 23:03:01 -07:00
khazhyk 52c45da0bc simplify AuditLogIterator ordering
rename reverse to oldest_first and remove cases where messages would
be ordered differently from the order we fetch audit log entries,
similar to HistoryIterator
2019-04-07 22:46:41 -07:00
khazhyk 366dc4855b simplify HistoryIterator message ordering
rename reverse -> oldest_first, which is more obvious what it does.
Then, honor it entirely - if you specify no `after` endpoint, we default
to the beginning of message history, similar to how `before` defaults to
the end of message history.

This is a breaking change, and will change the behavior of any iterator
that previously would have been returning messages in a weird order for
limits over 100

`for msg in history(reversed=True, limit=300)` would return the newest
300 messages, in a messed up order (100..0, 200..100, 300..200).
`for msg in history(oldest_first=True, limit=300)` will now return the
oldest 300 messages in order. And so on.

`for msg in history(after=msg)` is unchanged, this previously would
return the oldest 100 messages after `msg`, oldest->newest order, and
still will.
2019-04-07 22:46:40 -07:00
khazhyk 7078b665a3 allow passing 0 for logs_from parameters 2019-04-07 22:18:30 -07:00
Rapptz 72b6152e96 Client.event raises TypeError instead of ClientException. 2019-04-07 22:33:38 -04:00
Rapptz aeabd0761e [commands] Raise TypeError instead of ClientException in some places
Certain decorators and functions expect coroutines and raise an
exception when this is not met. Change these to raise the appropriate
TypeError since they can't actually be handled by the user gracefully
anyway.
2019-04-07 22:31:05 -04:00
Rapptz 84c1eac62a Don't raise an exception during the signal handlers. 2019-04-07 16:10:44 -04:00
Rapptz 7b95611e62 Forgot to escape backticks. 2019-04-07 00:46:15 -04:00
Rapptz 4d06879669 Add ignore_links and as_needed options to utils.escape_markdown.
This allows for URLs to be left alone since they can include markdown
characters and allows for total escaping of all markdown characters
by default to prevent some form of data manipulation.
2019-04-07 00:24:34 -04:00
Rapptz d68af294a2 Fix regex substitution in utils.escape_mentions 2019-04-06 23:02:49 -04:00
Rapptz 47ab24991f [commands] Remove extraneous or 2019-04-06 22:02:58 -04:00
Rapptz 79a8249bc7 Add note about escape_markdown in Message.clean_content
Fix #1911
2019-04-06 21:50:56 -04:00
Rapptz ee81f0614e [commands] Fix HelpCommand.invoked_with when used in events. 2019-04-06 21:33:21 -04:00
Rapptz 239d430539 Simplify bot loop cleanup routine.
Attempted solution for #2040
2019-04-06 21:29:57 -04:00
Rapptz 7d385b23a1 Fix copy paste error in ClientUser.edit_settings 2019-04-06 20:19:16 -04:00
Rapptz 9248ff306c Use explicit __eq__ call to be consistent with other methods. 2019-04-06 20:18:10 -04:00
Rapptz 7c5a4b67d7 Fix Attachment.save wording nit. 2019-04-06 20:17:12 -04:00
Rapptz 9833ea82e2 Add helpers to escape markdown and mentions from text.
Fixes #1673
2019-04-06 20:14:05 -04:00
Rapptz 743a5a218f [commands] Disallow bot_ or cog_ commands or listeners in cogs. 2019-04-06 19:46:22 -04:00
Rapptz 79183846dc Make abc.GuildChannel.overwrites return a dictionary
Fix #2016
2019-04-06 19:33:31 -04:00
Rapptz e4de25eaab [commands] Raise BadArgument in ColourConverter when using from_hsv/rgb
Fixes #2043
2019-04-06 19:29:21 -04:00
CapnSandRapptz 24d3a5a48d Only escape characters as necessary in clean_content
Fixes #1885
2019-04-06 19:19:58 -04:00
NCPlayzandRapptz 1d701f32b6 Add fetch custom emoji, all custom emojis; Add user property to Emoji 2019-04-06 19:19:47 -04:00
VexsandRapptz 9591b00dcf Redesign bulk delete events
Change `parse_message_delete_bulk` to not dispatch individual
`message_delete` events, and instead `bulk_message_delete`. Also make
`raw_bulk_message` delete and `raw_message_delete` have message
objects attached.

Fixes #1807
2019-04-06 19:18:06 -04:00
NCPlayzandRapptz 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
Rapptz dea3ba5eb7 Propagate Cloudflare 429 HTML text. 2019-03-31 05:44:00 -04:00
4ec7213506 Added functionality to edit user settings
Changing docs to fit other parts of the lib

Co-Authored-By: CapnS <38225872+CapnS@users.noreply.github.com>

Removing Type Checking

Made all of Rapptz's suggested changes

Removing imports that are no longer needed
2019-03-28 17:33:39 -04:00
Rapptz 43b44751af [commands] Fix MinimalHelpCommand opening note signature consistency 2019-03-24 14:46:55 -04:00
Rapptz 548b9d5693 Double underscore HTTPClient's internal session. 2019-03-24 14:45:18 -04:00
Rapptz e567b59fea [commands] Double underscore some attributes. 2019-03-24 14:33:51 -04:00
Rapptz 8c0c410d0e [commands] Add HelpCommand.invoked_with
This fixes an issue where the context invoked_with does not match the
actual invoked with behaviour (e.g. using Context.send_help).
2019-03-24 14:27:37 -04:00
numbermaniacandGitHub 77dd4e3de0 guild.py: change wording for create_role error 2019-03-24 13:33:15 +11:00
Rapptz b41a29a889 Get cached message in reverse order for improved performance.
Most embed-only edits happen for the newest message.
2019-03-23 00:57:50 -04:00
Rapptz c96642860c [commands] Add Command.cooldown_after_parsing keyword argument.
This controls the behaviour of cooldown execution order. This does
not change the default behaviour however.
2019-03-22 22:23:07 -04:00
NCPlayzandRapptz a1caaf8dcf Add Guild.max_presences and Guild.max_members
Fixes #1822
Fixes #1418
2019-03-22 20:25:03 -04:00
CapnandGitHub fd3a176793 Fix documentation for Channel.last_message 2019-03-22 10:31:19 -05:00
Rapptz d48a424f6f Fix mistake in documentation. 2019-03-20 23:29:04 -04:00
Rapptz 72b6b67cf4 Add back PartialEmoji.__hash__ that was deleted due to __eq__. 2019-03-20 22:54:53 -04:00
Rapptz 64d749a13f [commands] Ensure handlers are copied even during update.
Fix #2001
2019-03-20 22:38:00 -04:00
Rapptz 5fe1ab279a Drop websockets version due to issues. 2019-03-20 22:33:20 -04:00
Rapptz 35c0476dbb Add TextChannel.last_message_id and TextChannel.last_message 2019-03-20 22:30:23 -04:00
apple502jandRapptz 9c32bcdf80 Update docs, mostly Inviting Your Bot 2019-03-20 22:30:22 -04:00
DiceandRapptz 8123d4a5f7 Add type checking to multi-file send
Convert list comprehension to genexpr
2019-03-20 09:22:08 -04:00
DiceandRapptz 6f3e32cfbb Fix sending multiple files
Fixes #2002
2019-03-20 09:21:16 -04:00
Rapptz c30a366106 Try to consistently use "inherit" vs "derive" in documentation. 2019-03-19 09:23:12 -04:00