53 Commits

Author SHA1 Message Date
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
CapnS
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
mental
ee57e89488 Added hypesquad house functionality 2018-08-22 22:01:19 -04:00
MaximusPX
4a1d28a1de Adds missing voice regions. 2018-08-22 21:07:54 -04: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
Mippy (William)
98c8928934 Missing Voice Regions 2017-11-12 16:58:31 -05: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
Gorialis
934456035e Change VerificationLevel, ContentFilter to be IntEnums 2017-08-02 01:24:05 +09:00
Rapptz
25a1d8c300 Add support for user flags in Profile. 2017-06-30 18:49:49 -04:00
Rapptz
83f86f902a Rename verification level to extreme due to demand. 2017-05-27 22:19:31 -04:00
Rapptz
ee3c77353f Add highest verification level. 2017-05-27 01:12:06 -04:00
Rapptz
a0fc1402d7 Rename GuildRegion to VoiceRegion.
This naming makes more sense since voice regions are not a guild
exclusive concept.
2017-05-09 13:42:35 -04:00
Rapptz
86bfcdd129 Add support for message delete audit log action type. 2017-05-04 04:35:02 -04:00
Rapptz
c54a6a927d Implement audit logs. 2017-04-30 02:58:27 -04:00
Rapptz
83649d7f0a Support for new member message types. 2017-04-21 03:49:05 -04:00
Rapptz
0e5bf09021 Export missing enums. 2017-04-12 20:20:35 -04:00
Rapptz
728fae9285 Add Guild.explicit_content_filter. 2017-04-12 20:18:28 -04:00
Rapptz
ff9f5749e1 Update copyright year to 2017. 2017-01-20 23:19:19 -05:00
Rapptz
4c981ee631 Add support for relationships. 2017-01-20 19:28:43 -05:00
Rapptz
63604e0566 Use CDN URL for default avatars. 2017-01-09 03:35:51 -05:00
Rapptz
d1d54a468a Rename Server to Guild everywhere. 2017-01-03 09:51:54 -05:00
Rapptz
7272190e2d Add support for "Do Not Disturb" and "Invisible" statuses.
This deprecates Client.change_status in favour of the newer and more
correct Client.change_presence.
2016-09-26 19:55:42 -04:00
Rapptz
203c64a9a4 Add support for server verification levels.
This adds a new enum named VerificationLevel to denote said verification
level. This enum will also be used in the Client.edit_server calls
instead of the undocumented int parameter.
2016-09-12 22:38:06 -04:00
Rapptz
da986b2d7c Support for pinned system messages. 2016-09-12 20:22:53 -04:00
Rapptz
8384edb061 Add new EU Central and EU West server regions. 2016-09-09 19:23:55 -04:00
Rapptz
e60047b756 Add remaining server regions to the enum. 2016-07-14 15:03:43 -04:00
Rapptz
a128249b63 Add support for different message types and call message. 2016-07-13 20:11:18 -04:00
Rapptz
69c506d7ae Handle CHANNEL_UPDATE for group direct messages. 2016-07-13 17:23:35 -04:00
Rapptz
ddd3fd0a3d Begin working on gateway v6 changes.
The first batch of changes are related to channel types and group
direct messages. Support these first so READY begins parsing.
2016-07-13 00:10:16 -04:00
Khazhismel Kumykov
5f776f369d Add default avatar property to User. 2016-03-31 14:38:03 -04:00