Commit Graph
181 Commits
Author SHA1 Message Date
Rapptz 72275a73fa Use non-underscore TypeVar in enum code 2021-04-06 07:35:02 -04:00
Rapptz 008432c76a Make enum code work with typecheckers
This also makes it so invalid enum values fall back to a proxy type
that still works similar to actual values.
2021-04-06 01:11:36 -04:00
Rapptz 8cece19b22 Add on_interaction event and Interaction class.
This is the first pass at the functionality. It's currently a bit
incomplete.
2021-04-06 01:11:36 -04:00
Rapptz 54288879e2 Remove userbot functionality
This has a lot of legacy and cruft so there may be some stuff I've
missed but this first pass is enough to get a clear separation.
2021-04-04 10:15:30 -04:00
Rapptz 9d39b135f4 Modernize code to use f-strings
This also removes the encoding on the top, since Python 3 does it by
default. It also changes some methods to use `yield from`.
2021-04-04 07:03:53 -04:00
Nadir Chowdhury 1b2688518e Implement StageChannel and related methods 2021-04-03 22:43:41 -04:00
Nadir Chowdhury 6f748e5da5 Add remaining v6 message types 2021-02-23 03:57:11 -05:00
Nihaal Sangha 69bdc3a184 Change copyright year to present 2021-01-15 05:28:11 -05:00
Rapptz bd6ab93348 Code cleanup involving enums and message replies 2020-11-27 00:32:08 -05:00
Rapptz c8954906cb Sticker implementation cleanup 2020-11-23 06:05:25 -05:00
Zomatree 344cb96c5d Add sticker support 2020-11-23 05:09:20 -05:00
Rapptz 23ae084b8c Allow finer grained control over the member cache. 2020-09-23 03:21:20 -04:00
iDutchy cc26499237 Add competing activity type 2020-09-20 00:05:18 -04:00
Patrick 9121441315 Add South Korea VoiceRegion 2020-08-18 01:11:33 -04:00
Nadir Chowdhury 360fc123c6 Add remaining user flags 2020-08-05 22:04:09 -04:00
Nadir Chowdhury a64006ee9b Add support for integrations 2020-06-28 14:50:43 -04:00
JohnyTheCarrot ab5f995d78 Add support for public user flags 2020-05-29 22:40:14 -04:00
apple502j 6d0db182b9 Add new alias VerificationLevel.very_high 2020-04-09 17:10:44 +09:00
Rapptz 6071607176 Bump copyright year to 2020
Closes #2510
2020-01-19 20:03: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
NCPlayz 787d424dce Add VoiceRegion.dubai 2020-01-06 00:30:04 -05:00
Christian Clauss f9b8b234e3 Typo: AuditLogActionCategory 2019-12-23 00:49:17 +01:00
Rapptz c92ca4ee07 Add Profile.system and Profile.team_user to query newer flags 2019-12-21 07:46:15 -05:00
NCPlayz f554819506 Implement Webhook.type 2019-11-26 05:16:53 -05:00
Josh B 7df5effbb7 Add new audit log entry types. Fix issue with unknown entry types 2019-11-26 05:16:53 -05:00
apple502j 6241983a99 Add europe region 2019-10-17 05:56:01 -04:00
Dice da4bb0610c Add CHANNEL_FOLLOW_ADD Message Type
Add documentation for MessageType.channel_follow_add

Add versionchanged to new MessageType attr

Add system_content for new MessageType
2019-08-27 04:05:03 -04:00
fourjr 3961e7ef6d Support team members data in application info 2019-06-29 19:14:24 -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
Rapptz 855a6c5b59 Fix descriptor detection in enum code. 2019-06-09 08:13:29 -04:00
Rapptz 2b761508f1 Disallow deleting of enum attributes. 2019-06-09 02:13:40 -04:00
Rapptz 6931189b92 Add EnumMeta.__reversed__ just in case someone does this.
I sure hope not.
2019-06-09 02:02:06 -04:00
Rapptz a92b4c2093 Add EnumMeta.__len__ to not break user avatar code. 2019-06-09 01:59:23 -04:00
Rapptz d7814cfb25 Remove unused import. 2019-06-09 01:06:20 -04:00
Rapptz 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
Rapptz 5dce3410e6 Add support for new message types related to premium guilds. 2019-06-04 18:30:47 -04:00
apple502j 357abf2e55 Add India region to VoiceRegion 2019-05-13 20:26:10 -04:00
Rapptz 919dbcafb3 Consistent use of __all__ to prevent merge conflicts. 2019-04-20 17:20:58 -04:00
Rapptz 6f26a4aad8 Improve performance of value -> enum by about 5x. 2019-04-15 21:30:47 -04:00
Rapptz 67ec59caea Fix issue with speaking state causing an error. 2019-04-08 23:08:43 -04:00
Rapptz 0ddc6867e9 Change all IntEnum to Enum
A testament to how many 3.5 users there are.
2019-04-08 17:51:14 -04:00
CapnSandCapnS 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 5061915b2a Add support for store channels. 2019-03-17 14:32:51 -04:00
Rapptz 5ea84fb971 Add support for guild news channels. 2019-03-08 21:40:43 -05:00
Liam H 79f172cf80 Add PremiumType enumeration and ClientUser.premium_type 2019-02-12 19:01:10 -05:00
Imayhaveborkedit 9c5259afd7 Update voice code to vws V4
- Update internals to be compatible with v4
- Adds multiple encryption mode support.  Previously only `xsalsa20_poly1305` was supported.  Now `xsalsa20_poly1305_suffix` is also supported.
  Note: There is no (nice) way to manually select a mode.  The user needn't worry about this however.
- Fixed speaking state bug.  When you disconnected from a voice channel while a bot was playing, upon reconnect you would be unable to hear the bot.  This was caused by bots not sending their speaking state while transmitting.  Bots will now set their speaking state properly when transmitting.  
  Note: This does not account for sending actual silence, the speaking indicator will still be active.
2019-01-28 22:22:52 -05:00
Dante Dam 9656a21ebe Bumped copyright years to 2019. 2019-01-28 22:22:50 -05:00
Rapptz 8b18fa307b Add support for default notification level in audit logs and Guild.edit 2018-11-25 01:42:33 -05:00
Chris 1ac432d9f0 Add Guild.default_notifications 2018-11-24 23:05:26 -05:00
bmintz c184b0a53d add support for Bug Hunter and Early Supporter flags 2018-11-24 22:34:22 -05:00