Commit Graph
100 Commits
Author SHA1 Message Date
Rapptz 42a084028c Expose _ActivityTag as BaseActivity to easily refer to. 2020-01-14 20:56:00 -05:00
Rapptz a841efa087 Add support for custom activities
It's been long enough.

Fixes #2400
2020-01-14 20:37:48 -05:00
Rapptz e5870903f5 [commands] Force the predicate attribute in checks to be a coroutine 2020-01-14 20:13:33 -05:00
Rapptz 82797b0e60 [commands] Add missing CheckAnyFailure documentation 2020-01-14 19:54:10 -05:00
Rapptz cd9135b082 Rewrite on_ready delay to actually make sense and prevent heavy sleep 2020-01-14 19:52:06 -05:00
Rapptz e91675291e Fix bug preventing movement of channels when there are gaps in position
The original code was too aggressive in ensuring that the channel
positions are correct and within bounds. Unfortunately, for Discord
this number is merely a guess and there can be gaps that cause the
position number to be greater than the number of channels currently
in that sorting bucket.

One such example of this is when a channel is deleted and created. When
this happens, the positions are not updated (presumably because Discord
considers this to be too expensive). Sadly this means that if a user
were to create a channel, delete a channel, and then create another one
then there will be gaps in the position sequence.

More concretely, consider the following example:

Channels with position [0, 1, 2, 3, 4]. A new channel is created so it
inherits the maximum position giving us [0, 1, 2, 3, 4, 5]. We delete
a channel that's smaller than the maximum so our list now looks like
[0, 1, 2, 4, 5]. Next time we create a channel we will further
increment the gap, giving us [0, 1, 2, 4, 5, 6]. If a user would want
to move the channel with position 4 to be after position 6 (so in this
case that value would 7) then the library would erroneously raise an
error because it assumed too much about the data integrity.

Luckily, the library upon actually doing the request fixes the channel
positions so everything goes back to normal like it was intended. That
is to say, [0, 1, 2, 3, 4, 5].
2020-01-12 03:27:48 -05:00
Rapptz bfaf8ecfdb Allow Guild.fetch_members to take in limit=None
Fixes #2473
2020-01-12 02:44:16 -05:00
Rapptz 2770137bd6 Redesign permissions to allow aliases to be used.
This adds manage_permissions, view_channel, and use_external_emojis
aliases to Permissions. It should be noted that to prevent breaking
changes and for sake of usefulness, aliases are not included in
the `__iter__` for either Permissions or PermissionOverwrite.

Fixes #2496
2020-01-11 19:52:25 -05:00
Rapptz 92a3c1b583 [commands] Document guild permission checks 2020-01-07 04:50:52 -05:00
Rapptz de5caf59d6 Cache member.roles access to avoid surprising performance traps
Without the cache, repeated access could be accidentally quadratic or
worse.
2020-01-06 22:13:35 -05:00
Rapptz ae3dac0d59 [commands] Add check_any check to OR together various checks 2020-01-06 22:03:56 -05:00
Rapptz 51546dbdb6 [commands] Document the changed Command.can_run behaviour 2020-01-06 04:02:56 -05:00
Rapptz f1118273f5 Fix Member.mentioned_in returning True if in separate guilds 2020-01-06 00:30:04 -05:00
Rapptz 527b3485dc [commands] Make Command.can_run process disabled commands 2020-01-06 00:30:04 -05:00
Rapptz 195b5188e8 Add Attachment.to_file to easily send an attachment.
The first thing someone will ask when someone sees this method is
"Why doesn't `send` just accept `Attachment`?". This question is fair
but it has an issue: exception propagation becomes confusing.

When we save a file and write it to memory an HTTP request is sent
similar to other API calls. Like all HTTP requests, these can fail.
Since these requests denote failure using HTTPException, if it were to
originate within `send` then it becomes confusing to know whether the
attachment saving itself failed or whether the sending failed.

For that reason, and to keep in-line with only 1 type of HTTP call per
method, it doesn't make sense for `send` to support `Attachment`.
2020-01-03 20:42:45 -05:00
Rapptz 6847f13198 Document that widget members may be incomplete.
See https://github.com/discordapp/discord-api-docs/issues/1287
2019-12-29 04:19:08 -05:00
Rapptz fdab6e464f Remove unnecessary pass using regex in Message.clean_content
The utils.escape_mentions should deal with it
2019-12-25 04:19:27 -05:00
Rapptz c92ca4ee07 Add Profile.system and Profile.team_user to query newer flags 2019-12-21 07:46:15 -05:00
Rapptz 2de90fbecf Add User.system and MessageFlags.urgent 2019-12-21 07:39:33 -05:00
Rapptz f7687e0a68 Clean up flag code significantly.
This also fixes the False setting bug.
2019-12-20 21:18:31 -05:00
Rapptz fe1ebb3144 Default the Streaming name to the one passed for user created ones. 2019-12-19 21:26:41 -05:00
Rapptz d9a8ae9c78 [commands] Add predicate attribute to checks to get inner function 2019-12-18 01:20:50 -05:00
Rapptz ec4962a14c Wait 5 seconds before IDENTIFYing with an invalidated session. 2019-12-17 23:34:49 -05:00
Rapptz 1179df7e29 [commands] Make Greedy ignore parsing errors. 2019-12-17 00:27:56 -05:00
Rapptz 7045639adc Fix KeyError for things without a created_at 2019-12-05 04:36:04 -05:00
Rapptz c62b6c3e88 Fix more deprecation warnings for 3.8 2019-11-26 05:19:11 -05:00
Rapptz 4ef0fb0d95 Fix more deprecation warnings 2019-11-20 03:04:04 -05:00
Rapptz 1b040fd4ba Fix one more remaining loop passing for 3.8 in a Lock 2019-11-20 02:37:00 -05:00
Rapptz a6f61dcbde Fix all deprecation warnings for 3.8 2019-11-20 02:30:19 -05:00
Rapptz 924398c1ac Trailing whitespace in documentation. 2019-11-20 01:43:01 -05:00
Rapptz 45f342ff79 Fix regression with references being overwritten from the cache.
A proper fix for this would be to just request presence information
as well since the chunk request would probably be more up to date than
the current cache. However this delta requires a little bit more work
and will be done later.
2019-11-20 01:41:23 -05:00
Rapptz 15f0b000e1 Move PartialEmoji over to a new namespace to avoid circular imports 2019-11-20 00:50:19 -05:00
Rapptz e1a237a0d3 Revert "[tasks] Add Loop.exception for more reliable exception retrieval."
This reverts commit 7a8c9e66d9.
2019-11-19 21:59:39 -05:00
Rapptz 071c5b89e0 Revert "[tasks] Add support for explicit time parameter when running."
This reverts commit 9f822a1e6d.
2019-11-19 21:59:27 -05:00
Rapptz a238c6178a Update regex to fetch URLs to match the official client.
Fixes #2420.
2019-11-18 22:22:54 -05:00
Rapptz cb21159589 Document that PartialEmoji.name can be None 2019-11-18 20:00:06 -05:00
Rapptz d8e47b08a2 Manually trigger GC in cases of large deallocations. 2019-11-18 19:24:33 -05:00
Rapptz ade8d03f54 Add changelog for 1.2.5 2019-11-18 19:21:40 -05:00
Rapptz 89bfd9cc20 animation field in reaction objects are not consistently available 2019-11-15 04:37:39 -05:00
Rapptz bf3e0a94b8 Add changelog for v1.2.4 2019-10-17 21:01:59 -04:00
Rapptz ea3d119ca6 Use X-Ratelimit-Reset-After header by default.
There is now an option to turn it off, of course.
2019-08-27 18:41:32 -04:00
Rapptz 1c6c26ee38 Fix bucket key to not have the method in there. 2019-08-27 18:41:32 -04:00
Rapptz 078d1d71d8 Use new rate limit millisecond precision option. 2019-08-27 18:41:31 -04:00
Rapptz 5d7cf56d7f Actually add things to the message cache. 2019-08-27 18:36:40 -04:00
Rapptz 5c0b127c96 Create Permissions and Colour objects when necessary in Role
This should have some memory savings of ~24 bytes per role.

* 8 bytes for Permissions
* 8 bytes for Colour
* 8 bytes for the alias

I'm not sure how significant it is but it should be a decent amount.
2019-08-27 18:34:40 -04:00
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
Rapptz 1488957a6f Add Message.is_system to more intuitively filter system messages. 2019-08-27 04:13:46 -04:00
Rapptz 3dc9f40be7 Add versionadded string to GuildChannel.permissions_synced 2019-08-27 04:06:27 -04:00
Rapptz 87c2508199 Explicitly mention discord.Object in abc.Snowflake documentation. 2019-08-11 20:12:32 -04:00
Rapptz f513d831d1 Add RawReactionActionEvent.event_type attribute.
This helps differentiate between reaction removal or addition.
2019-08-11 19:11:22 -04:00
Rapptz ceaba01776 Add version information from missing PRs. 2019-08-11 19:04:39 -04:00
Rapptz 9f822a1e6d [tasks] Add support for explicit time parameter when running.
Fixes #2159
2019-08-11 18:57:49 -04:00
Rapptz 12343c1422 Add versionadded tags to new ffmpeg related classes. 2019-07-27 23:17:06 -04:00
Rapptz 7a8c9e66d9 [tasks] Add Loop.exception for more reliable exception retrieval. 2019-07-27 23:07:48 -04:00
Rapptz 46f6003c66 Version bump for development purposes. 2019-07-27 22:42:04 -04:00
Rapptz cddcc6d6b6 abc.Messageable do not have to implement abc.Snowflake
Fix #2290
2019-07-27 22:38:30 -04:00
Rapptz dd12fbf73d [commands] Properly load the original module when reloading fails.
Fix #2291
2019-07-27 22:37:55 -04:00
Rapptz 8e594ac1ad Escape quote markdown in utils.escape_markdown 2019-07-27 22:14:14 -04:00
Rapptz 18fe2035ef Document that the cache retrieval functions require an int ID.
Closes #2285
2019-07-23 04:01:14 -04:00
Rapptz 45375364b7 Fix breakage with webhook tokens being missing. 2019-07-22 20:55:43 -04:00
Rapptz 93f719aeb7 Proper boolean check for caching members. 2019-07-15 08:26:22 -04:00
Rapptz f13c1be171 Better knowledge on how guild_subscriptions work now. 2019-07-15 08:01:57 -04:00
Rapptz 5b2f630848 Add Guild.query_members to fetch members from the gateway. 2019-07-15 07:56:48 -04:00
Rapptz bc352f0e50 Allow complete disabling of the member cache. 2019-07-11 00:49:30 -04:00
Rapptz edcd9459e3 Use Guild.owner_id in Guild.edit when checking if the bot owns a guild. 2019-07-10 14:39:12 -04:00
Rapptz 562580a07f Use lower level Guild.owner_id for permission resolution. 2019-07-10 14:30:53 -04:00
Rapptz 91f1f430e1 Fix NameError in member upgrade code 2019-07-10 06:11:03 -04:00
Rapptz ca2ee0655d Add versionadded for guild_subscriptions option. 2019-07-10 05:00:13 -04:00
Rapptz 2e6882bd8c [commands] Fall back to using Message.mentions in converters
Useful if there's no cache.
2019-07-10 04:51:27 -04:00
Rapptz bbc50c92d0 Add upgraded Member to Message.mentions in case of no cache. 2019-07-10 04:51:27 -04:00
Rapptz 5f272fa151 Add VoiceChannel.voice_states low level helper. 2019-07-10 04:51:27 -04:00
Rapptz 7b8d50a988 Add support for guild subscriptions. 2019-07-10 04:51:27 -04:00
Rapptz 5c1b239b47 Different method of upgrading user instances 2019-07-10 01:23:38 -04:00
Rapptz e75c248a9a Properly populate __slots__ for derived user types.
Fixes #2265
2019-07-09 22:51:49 -04:00
Rapptz 6f71552c50 [commands] Don't update sys.modules with a stale reference. 2019-07-07 20:17:44 -04:00
Rapptz 70e62e8fe4 Fix regression where Message.edited_at would not update during edits 2019-07-05 23:52:47 -04:00
Rapptz 4c917d10de Use the standard way of detecting RTD 2019-07-01 00:37:35 -04:00
Rapptz ac00fcad77 Flatten genindex to not group names.
Also better width in the tables.
2019-06-30 18:59:19 -04:00
Rapptz b31028fa19 Fix some linking issues with TeamMembershipState 2019-06-30 02:38:56 -04:00
Rapptz 604e9dfc67 Remove constructibility from certain classes in documentation. 2019-06-30 02:37:59 -04:00
Rapptz ccb26018ab Export Team related stuff from __init__ 2019-06-30 02:34:42 -04:00
Rapptz ba7a319ab0 Team.owner should return a TeamMember.
Should always be available but who knows.
2019-06-30 02:34:42 -04:00
Rapptz c4d1bd7899 TeamMember inherits from BaseUser instead of attribute. 2019-06-30 02:34:42 -04:00
Rapptz d4b13bd32b [commands] Fix up Paginator documentation.
These aren't optional.
2019-06-29 20:29:13 -04:00
Rapptz 0cca3ca5c6 Add support for suppressing embeds. 2019-06-29 20:26:47 -04:00
Rapptz 203d702d46 Add unused Guild.preferred_locale 2019-06-29 20:17:18 -04:00
Rapptz 2c16e43e8a Fix regression with unresolved channels due to reordering.
Channels are meant to fallback to Object if the message is out of
order. Somewhere along the commit line this got removed despite the
issue still existing.
2019-06-29 19:41:38 -04:00
Rapptz 68342db04d [commands] Properly raise the correct exception for owner_ids
Also some minor nits with documentation.
2019-06-29 19:26:45 -04:00
Rapptz d747f2c88b Use a new scorer to improve search results.
This makes the other pages take less priority than the API results.
It's kind of biased, but hopefully it helps out.
2019-06-29 02:36:26 -04:00
Rapptz c26797d808 Proper RTD detection. 2019-06-29 02:34:11 -04:00
Rapptz 1652539d40 Disable RTD search.
It's completely broken anyway.
2019-06-29 01:31:00 -04:00
Rapptz ab00bc0686 Strip discord.ext in genindex page and unbreak PEP links. 2019-06-28 21:29:43 -04:00
Rapptz acda808803 Make the generated index page more useful for Ctrl + F. 2019-06-28 21:04:43 -04:00
Rapptz db67c79dbc Downgrade to Sphinx 1.8.5
For some reason 2.1.2 breaks localization.
2019-06-28 09:00:17 -04:00
Rapptz 7523f86006 Translation sync with Crowdin 2019-06-28 08:59:21 -04:00
Rapptz a129b4bb7e Make more use of screen space in the documentation.
Basically move from a 940px system to 1200px grid system.
Hopefully future DOM modifications will make this better.
2019-06-28 02:11:22 -04:00
Rapptz 7543328fe7 Update Sphinx to 2.1.2 2019-06-28 01:43:04 -04:00
Rapptz 0cf38241d0 Version bump to 1.2.3 2019-06-25 21:50:28 -04:00
Rapptz 1e982e0042 Cast activity enumerator to integer instead of accessing value directly
Should make the library more resilient to future changes.
2019-06-25 21:50:06 -04:00