Commit Graph

2006 Commits

Author SHA1 Message Date
850a0431bf Catch asyncio.CancelledError in 3.8 in typing context manager
In python 3.8, asyncio.CancelledError is a subclass of BaseException
rather than Exception, so `except Exception:` will not swallow
CancelledError. This change prevents an error in 3.8 from being printed
to the console when the following is run:

```
async with ctx.typing():
	pass
```
2019-06-20 22:51:28 -04:00
671a19a24a [commands] Ensure cooldowns are properly copied. 2019-06-12 23:40:43 -04:00
dfcf9cdb0a Rename error type for X.fetch_channel(s). 2019-06-12 00:47:42 -04:00
34b93c757c docs: Fix minor typo 2019-06-12 00:47:42 -04:00
2b4cf5dafc Set premium_since when copying and updating Member 2019-06-11 21:13:43 +02:00
e00635fba7 Version bump to 1.2.2 v1.2.2 2019-06-09 21:51:43 -04:00
e3e2e38511 Update docs to note Enum derivation change 2019-06-10 00:53:10 +10:00
3730e66d37 Crowdin translation sync 2019-06-09 08:20:43 -04:00
855a6c5b59 Fix descriptor detection in enum code. 2019-06-09 08:13:29 -04:00
7980213745 Version bump to 1.2.1 v1.2.1 2019-06-09 02:18:43 -04:00
2b761508f1 Disallow deleting of enum attributes. 2019-06-09 02:13:40 -04:00
6931189b92 Add EnumMeta.__reversed__ just in case someone does this.
I sure hope not.
2019-06-09 02:02:06 -04:00
a92b4c2093 Add EnumMeta.__len__ to not break user avatar code. 2019-06-09 01:59:23 -04:00
af4e3ad79b Some documentation touch-ups and missing stuff in the changelog. 2019-06-09 01:24:41 -04:00
d7814cfb25 Remove unused import. 2019-06-09 01:06:20 -04:00
a8f0a03247 Version bump to 1.2.0 v1.2.0 2019-06-09 00:39:38 -04:00
655aa39603 Fix reference typo in SystemChannelFlags 2019-06-09 00:38:46 -04:00
7e2da1c93b Publicly expose a type property for all channels.
Fix #2185
2019-06-09 00:23:22 -04:00
991140eebe Replace Enum with an internal one for significant speed improvements.
This has been a massive pain point for me personally due to the poor
design of the Enum class leading to the common use cases used in the
library being significantly slow. Since this Enum is not public facing
in terms of *creation*, I can only implement the APIs that are used
when *accessing* them.

This Enum is a drop-in replacement to the pre-existing enum.Enum class
except it comes with significant speed-ups. Since this is a lot to go
over, I will let the numbers speak for themselves:

In [4]: %timeit enums.try_enum(enums.Status, 'offline')
263 ns ± 34.3 ns per loop (7 runs, 1000000 loops each)
In [5]: %timeit NeoStatus.try_value('offline')
134 ns ± 0.859 ns per loop (7 runs, 10000000 loops each)

In [6]: %timeit enums.Status.offline
116 ns ± 0.378 ns per loop (7 runs, 10000000 loops each)
In [7]: %timeit NeoStatus.offline
31.6 ns ± 0.327 ns per loop (7 runs, 10000000 loops each)

In [8]: %timeit enums.Status.offline.value
382 ns ± 15.2 ns per loop (7 runs, 1000000 loops each)
In [9]: %timeit NeoStatus.offline.value
65.5 ns ± 0.953 ns per loop (7 runs, 10000000 loops each)

In [10]: %timeit str(enums.Status.offline)
630 ns ± 14.8 ns per loop (7 runs, 1000000 loops each)
In [11]: %timeit str(NeoStatus.offline)
253 ns ± 3.53 ns per loop (7 runs, 1000000 loops each)

In [12]: %timeit enums.Status('offline')
697 ns ± 8.42 ns per loop (7 runs, 1000000 loops each)
In [13]: %timeit NeoStatus('offline')
182 ns ± 1.83 ns per loop (7 runs, 10000000 loops each)
2019-06-09 00:06:34 -04:00
8bf0482af5 Fix exception hierarchy documentation. 2019-06-08 21:23:42 -04:00
126f4f8271 Implement Guild.get_all_premium_subscribers 2019-06-08 21:19:10 +01:00
c97b097f07 Document new Guild.features 2019-06-07 22:26:05 -04:00
f84219c2b2 Improve performance of parsing MESSAGE_UPDATE and MESSAGE_CREATE events
Embed edits are no longer special cased in the dispatch code, which
could lead to on_message_edit being called more often than it used to
be called. I am not sure on the general impact on that being removed.

Fixes #2195
2019-06-07 22:18:01 -04:00
3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
2f05436653 Added comment for/redo system information 2019-06-07 19:23:44 -04:00
f7c6c5995d Implementing GET '/channels/:id' & '/guilds/:id/channels'
Signed-off-by: NCPlayz <chowdhurynadir0@outlook.com>
2019-06-07 19:12:59 -04:00
320dbc0618 Add support for system channel flags 2019-06-06 22:30:02 -04:00
fcf02414fe Fix stray colon in Asset related docstrings 2019-06-04 19:06:31 -04:00
9674055c2a Add support for animated guild icons. 2019-06-04 19:04:44 -04:00
5dce3410e6 Add support for new message types related to premium guilds. 2019-06-04 18:30:47 -04:00
2b27a7a9d5 Add Member.premium_since to denote member boost date. 2019-06-04 18:30:46 -04:00
8e80eee0d1 Add Emoji.available field 2019-06-04 18:30:46 -04:00
a048815c60 Add Guild.premium_subscription_count 2019-06-04 18:30:46 -04:00
e40c68b75a Add Guild.premium_tier and corresponding limits. 2019-06-04 18:30:46 -04:00
90ae3f396c Probably fix indentation. 2019-05-30 19:39:50 -04:00
bfb1edcc05 Update readthedocs.yml to v2 configuration file. 2019-05-30 19:33:14 -04:00
483aa5465d Properly handle compute_prune_count in prune members endpoint. 2019-05-30 18:01:03 -04:00
00a0856cc4 Use a dict instead of getattr for parsing events.
Probably not a significant difference but might as well use it here.
The basic idea is to cache the getattr calls instead of repeatedly
doing it (since they're around 105ns on my machine). The dictionary
lookup is about 41ns on my machine.

The next step in speeding up library code some more should be in
the parser bodies themselves but that's a problem to tackle another
day.
2019-05-29 01:22:53 -04:00
0622e18cb9 Speed-up utils.get for the common cases 2019-05-29 00:45:48 -04:00
0d72ac3bb6 Ensure message links resolve in the Messageable.pins note. 2019-05-27 04:05:51 -04:00
96dc6f0c11 Add note that Messageable.pins does not contain Message.reactions
Fix for #2189
2019-05-27 04:04:06 -04:00
2cd6d771ec Make __repr__ slightly more detailed and add a few missing ones.
This includes raw events (which didn't have any) and a few other
types that were missing them. Upon review some more useful fields were
added to the repr output which would be more useful during debugging.
2019-05-26 02:32:47 -04:00
ab6dd2a27a Add note for Message.tts
Fix #2186
2019-05-25 06:17:52 -04:00
3c387e9031 Use attrgetter to speed up Member attribute access by 2x. 2019-05-25 03:14:35 -04:00
d96b8a0b80 Add Discord error code to HTTPException message. 2019-05-24 04:23:06 -04:00
fc5a2936dd Fix pluralization errors in various files
* Replaced instances of 'return an' with 'returns an'
* fixed pluralization errors
2019-05-23 23:31:17 -04:00
84e9168447 Grammar fixes for notes on EmbedProxy 2019-05-23 23:21:40 -04:00
f2c7b2e6d8 Add an insert_field_at method for the embed class 2019-05-23 23:21:39 -04:00
2fd589874f Fix wording in documentation for ClientUser.locale 2019-05-21 21:15:26 -04:00
998980ed9a Added example for template checkboxes 2019-05-21 21:15:25 -04:00