Commit Graph
100 Commits
Author SHA1 Message Date
Rapptz da5776a358 [commands] Make ConversionError have the original error as an attribute 2018-07-20 05:54:51 -04:00
Rapptz 92dde9aef9 [commands] Add support for typing.Union as a converter 2018-07-20 05:51:43 -04:00
Rapptz 4aecdea052 Make TextChannel.create_webhook name parameter mandatory. 2018-07-20 04:17:28 -04:00
Rapptz 351bb1927a Fix crashing with wonky TYPING_START events.
Fixes #1439
2018-07-20 04:15:58 -04:00
Rapptz 983be10111 Fix __aiter__ compatibility with 3.7. 2018-06-29 21:51:25 -04:00
Rapptz 1538c78836 Change jump_to_url to jump_url and fix format.
People kept asking, might as well.
2018-06-29 21:50:38 -04:00
Rapptz 0ba958bae4 Bump Sphinx to 1.7.4 2018-06-21 03:45:38 -04:00
Rapptz 607771c4f4 Fix Bot.get_prefix second parameter breaking. 2018-06-10 18:41:36 -04:00
Rapptz 5ae9ea26b1 Disable compression for websockets.
Increase of RAM and CPU doesn't give me much benefit I feel.
2018-06-10 18:37:51 -04:00
Rapptz e51f92e78d Fix NameError for typing context manager.
Fixes #1342
2018-06-10 18:30:32 -04:00
Rapptz c67d95327e Remove dead package references. 2018-06-10 18:16:40 -04:00
Rapptz f25091efe1 Drop support for Python 3.4 and make minimum version 3.5.2. 2018-06-10 18:10:00 -04:00
Rapptz 7eb918b19e Add Message.jump_to_url 2018-06-10 15:25:17 -04:00
Rapptz 6b75179c1f Remove emojis from cache if they're removed from a guild. 2018-05-19 17:07:45 -04:00
Rapptz 0dafdedc65 abc.GuildChannel.set_permissions can raise NotFound.
Fix #1254
2018-05-18 20:17:49 -04:00
Rapptz 07a535f514 Document user parameter in Guild.get_ban 2018-05-08 22:03:30 -04:00
Rapptz 60f0b22cbb Filter null mentions when creating a Message. 2018-04-20 00:32:23 -04:00
Rapptz 56650ae7c2 Change raw events to use slotted data models instead of parameters.
This allows for internal changes in Discord to not cause a breaking
change every time something changes.

Also implements #1214 which adds guild_id to every event where
applicable.

This is a breaking change.
2018-04-14 02:23:38 -04:00
Rapptz e04629999b Downgrade websockets due to bugs.
https://github.com/aaugustin/websockets/issues/350 keeps causing too
many issues for too many people for this version to be used by the
public users of this library.
2018-04-09 04:14:12 -04:00
Rapptz 3cb6ac152e Userbots do not have a DM cache cap limit. 2018-04-02 00:42:14 -04:00
Rapptz 95de4d1df1 Actually fix the order in Guild.by_category. 2018-03-31 23:16:53 -04:00
Rapptz 87a7efc410 Flip comparison in Guild.by_category. 2018-03-31 22:55:42 -04:00
Rapptz 796ff6d7e6 Sort voice channels below text channels in Guild.by_category 2018-03-25 04:00:47 -04:00
Rapptz f176309179 [commands] Don't handle single quotes. 2018-03-20 03:25:40 -04:00
Rapptz eb5defed00 Fix Webhook.guild raising an AttributeError.
Fixes #1148
2018-03-16 17:59:50 -04:00
Rapptz e9916e2844 Convert Client.activity back to an Activity-like object 2018-03-06 18:13:17 -05:00
Rapptz 61c8e35929 Missing import for _ActivityTag inside Client 2018-03-06 09:10:13 -05:00
Rapptz 857e30c68e Add some documentation for the Game to Activity breaking change. 2018-03-06 01:21:25 -05:00
Rapptz d8a85f4898 [commands] Minor optimisations to unicode quote handling. 2018-03-06 01:16:00 -05:00
Rapptz 871a262ee3 [commands] Add ability to have case insensitive commands.
This is powered by a dict-like class for the people who want to opt-in
to the performance downgrade for usability for majority English
speaking users.

Since it is slower than the regular dict due to the excessive calls to
str.lower along with the possibilities of gotchas for other languages
outside of English, this is kept as False for the default case.
2018-03-06 00:37:12 -05:00
Rapptz 1590441dbf Fix typo in TextChannel.delete_messages documentation. 2018-03-06 00:19:58 -05:00
Rapptz a425bd91be Fix invalid close errors on websockets 4.x
Fixes #1110
2018-03-06 00:15:36 -05:00
Rapptz 0fcd385b9a Add ability to change the activity used when logging in at runtime. 2018-03-05 11:23:07 -05:00
Rapptz f8f8f418f3 Split Game object to separate Activity subtypes for Rich Presences.
This is a massive breaking change.

* All references to "game" have been renamed to "activity"
* Activity objects contain a majority of the rich presence information
* Game and Streaming are subtypes for memory optimisation purposes for
  the more common cases.
* Introduce a more specialised read-only type, Spotify, for the
  official Spotify integration to make it easier to use.
2018-03-05 11:15:49 -05:00
Rapptz 6782fdd34d Add missing coroutine decorator to HTTPClient.get_attachment
Fixes #1104
2018-02-26 18:55:05 -05:00
Rapptz 1c215cfbbe Don't cache webhook users.
Fixes #1101
2018-02-24 17:37:37 -05:00
Rapptz 355eb08b25 Add seek_begin keyword argument to Attachment.save 2018-02-13 05:41:10 -05:00
Rapptz 4fef6fc4b0 Fix minor typo in migrating documentation. 2018-01-22 17:34:46 -05:00
Rapptz 8de382fcd3 Change logic in PartialEmoji.__str__ a little. 2018-01-06 17:35:03 -05:00
Rapptz 30b5047b0e Fix multipart sending for RequestsWebhookAdapter to work. 2018-01-03 21:55:48 -05:00
Rapptz 6813280938 websupport is not actually a Sphinx extension apparently. 2017-12-29 06:34:06 -05:00
Rapptz e9f887aab2 Add websupport extension to extension list. 2017-12-29 06:29:59 -05:00
Rapptz 3a8b97ffb0 [commands] Document that can_run can raise. 2017-12-29 06:00:25 -05:00
Rapptz e61ac8e60f [commands] Forbid passing a string to aliases in Command.
Fixes #974
2017-12-29 01:42:45 -05:00
Rapptz 300c0f7b19 Pip version requires require all 3 digits. 2017-12-28 21:39:44 -05:00
Rapptz 5c65acd9b3 Add some dependencies for RTD. 2017-12-28 21:34:41 -05:00
Rapptz da9828c41f Use the proper endpoint for removing your own reaction. 2017-12-21 19:20:48 -05:00
Rapptz 97fc4bf651 Update Emoji.url to point to the GIF version of the animated emoji. 2017-12-21 18:55:13 -05:00
Rapptz a6bf792dec Animated emoji support. 2017-12-21 18:51:47 -05:00
Rapptz e2f7945f59 Proper variable name in Client.clear. 2017-12-20 09:45:09 -05:00
Rapptz 5c5a59c18e Add Client.clear to clear the bot's internal state to a clean slate.
In case you want to have some external restart loop.
2017-12-16 21:36:39 -05:00
Rapptz 45432ab26f Update README to point to new server. 2017-11-28 17:07:13 -05:00
Rapptz 5013102574 Fix Webhook.delete not working. 2017-11-07 05:36:55 -05:00
Rapptz 89bbbec37e Missing name parameter in VoiceChannel.edit documentation. 2017-10-26 05:36:19 -04:00
Rapptz f0c53e4519 Fix URI quoting in Route. 2017-10-24 00:50:20 -04:00
Rapptz 47a58d354d Reimplement zlib streaming.
This time with less bugs. It turned out that the crash was due to a
synchronisation issue between the pending reads and the actual shard
polling mechanism.

Essentially the pending reads would be cancelled via a simple bool but
there would still be a pass left and thus we would have a single
pending read left before or after running the polling mechanism and
this would cause a race condition.

Now the pending read mechanism is properly waited for before returning
control back to the caller.
2017-10-14 21:19:46 -04:00
Rapptz 92a37c2e4f Revert "Implement zlib streaming for the gateway."
This reverts commit 462191a08b.
2017-10-14 15:22:39 -04:00
Rapptz 462191a08b Implement zlib streaming for the gateway. 2017-10-12 22:53:20 -04:00
Rapptz 9b4a2dc7cb [commands] Minor speed-up for the BucketType.guild case.
None case:
344ns ± 24.4ns -> 49.9ns ± 1.39ns

Valid case:
128ns ± 2.76ns -> 42.7ns ± 0.459ns
2017-10-08 07:57:58 -04:00
Rapptz 1bb7b6ff2d [commands] Make CooldownMapping.get_bucket take Message instead.
Requiring a full blown Context might be a bit overkill considering
we only use a single attribute from it.
2017-10-08 07:52:56 -04:00
Rapptz 065f408a10 Move pre-emptive message to DEBUG log level. 2017-10-01 13:43:20 -04:00
Rapptz 711dfb83ab Allow creating a channel with a category. 2017-09-29 05:54:29 -04:00
Rapptz 6d6ce14d7c Fix Guild.system_channel always returning None.
Fixes #811
2017-09-26 22:56:26 -04:00
Rapptz f86ac47b28 Don't use Bulk Channel Edit endpoint if not actually moving channels.
Should make the category-only edit cases more straightforward since
it does not rely on other guilds in the cache, outside of the category
itself.
2017-09-24 04:55:10 -04:00
Rapptz 148816c4e8 Temporarily add created channels to cache.
This should fix issues when doing a `abc.GuildChannel.edit` immediately
afterwards and then when the corresponding CHANNEL_CREATE comes in the
channel instance should hopefully be overwritten by the authoritative
figure, the WebSocket.
2017-09-23 18:54:12 -04:00
Rapptz 54f2c71e71 Fix margins on <p> tags. 2017-09-22 03:11:37 -04:00
Rapptz 458cb83b47 Properly handle cases where a category is removed. 2017-09-21 22:15:47 -04:00
Rapptz dbf8b5bda6 Fix header size warnings. 2017-09-21 21:16:00 -04:00
Rapptz e3d69ce83d Add custom details directive. 2017-09-21 21:15:37 -04:00
Rapptz 8ed5fe472c More CSS fixes. 2017-09-21 19:38:33 -04:00
Rapptz 2bfd15ba89 Fix weird margins with unordered lists in the HTML5 output. 2017-09-21 18:37:22 -04:00
Rapptz de6cffa347 Try to build HTML5 for docs. 2017-09-21 18:04:46 -04:00
Rapptz 95c28f08e4 Fix sorting for channels. 2017-09-21 00:11:36 -04:00
Rapptz 025136076a Add an example for on_reaction_add waiting.
Apparently people would rather read examples than the actual
documentation.
2017-09-18 05:46:51 -04:00
Rapptz 5e913b265b Change how coroutines are detected internally. 2017-09-16 13:35:00 -04:00
Rapptz 305cc3acfa Clarify VoiceClient.disconnect docs a little more. 2017-09-16 13:29:36 -04:00
Rapptz 7b2e06c263 Fix error when creating guild channels. 2017-09-13 18:47:40 -04:00
Rapptz e614f6b4cd [commands] Add CategoryChannelConverter 2017-09-13 17:19:30 -04:00
Rapptz 7df8897e3d Add Guild.create_category.
An alias, Guild.create_category_channel is provided.
2017-09-13 17:01:42 -04:00
Rapptz 53b4890435 Add category support.
This adds:

* CategoryChannel, which represents a category
* Guild.by_category() which traverses the channels grouping by category
* Guild.categories to get a list of categories
* abc.GuildChannel.category to get the category a channel belongs to
* sync_permissions keyword argument to abc.GuildChannel.edit to sync
  permissions with a pre-existing or new category
* category keyword argument to abc.GuildChannel.edit to move a channel
  to a category
2017-09-13 09:44:36 -04:00
Rapptz e24914be0b [commands] Fix NameError when given an invalid prefix.
Closes #775
2017-09-12 04:22:13 -04:00
Rapptz 3cd1fdc1eb Document new features for guilds. 2017-09-12 04:21:15 -04:00
Rapptz 1367877d36 Fix crashing for now when a category is created.
A full implementation will come later.
2017-09-08 21:30:25 -04:00
Rapptz 8912625428 Fix docstrings for Webhook.send 2017-09-08 04:23:11 -04:00
Rapptz 4564b46f95 Quick start example doesn't respond to ourselves. 2017-09-05 07:03:09 -04:00
Rapptz 21fd94a449 Attempt to change how member functions are detected for Member objects 2017-09-04 20:03:50 -04:00
Rapptz dcde896e14 Fix __hash__ for Invite objects. 2017-09-04 20:03:07 -04:00
Rapptz 63bca6604b Manually format reason parameter for kick and ban.
Related to: https://github.com/aio-libs/aiohttp/issues/2235
2017-08-30 17:58:53 -04:00
Rapptz ede1771960 Fix utils.get example. 2017-08-30 01:37:25 -04:00
Rapptz 62df23633a Sort roles by hierarchy instead of by ID.
Fixes #741
2017-08-29 16:24:04 -04:00
Rapptz 63fcfa6d02 [commands] Add CooldownMapping.from_cooldown factory classmethod. 2017-08-27 16:59:04 -04:00
Rapptz 1c967e9a7c [commands] Export cooldown classes as well. 2017-08-27 16:55:23 -04:00
Rapptz 94e2c0e661 Add upload from URL to the FAQ. 2017-08-25 09:07:30 -04:00
Rapptz 99bd595f5e Rename webhook parameters to payload to avoid shadowing.
The old names clashed with the `json` module.
2017-08-24 22:23:14 -04:00
Rapptz e7d3085445 Webhook URLs can have dashes and underscores. 2017-08-22 17:52:10 -04:00
Rapptz 8eb6fa0329 Fix multi-part sending with aiohttp in webhooks. 2017-08-22 00:26:43 -04:00
Rapptz 754f3a2ae9 Don't make session a keyword only argument. 2017-08-21 14:57:57 -04:00
Rapptz 84f38b166e Add atomic keyword argument for member role editing operations.
This affects:

* Member.add_roles
* Member.remove_roles

This is the main attempt of fixing long standing bugs like #56. Since
cache consistency is too hard to ask for due to eventual consistency
and this generally being one of the only main roadblocks that the
cache ruins, it's best to just implement it in terms of the atomic
endpoint instead.

Fixes #56
2017-08-21 10:40:33 -04:00
Rapptz e5ebea75a9 Lazily fetch Emoji.roles and Emoji.guild to prevent memory leaks.
The global emoji cache still managed to somehow cause memory leaks. By
storing IDs directly and lazily evaluating them when needed this
essentially removes all strong references to Guild objects which would
cause an explosion in memory usage.
2017-08-21 06:16:50 -04:00
Rapptz f1e59ea933 Game objects are really dumb. 2017-08-21 02:49:49 -04:00