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.
This commit is contained in:
Imayhaveborkedit
2019-01-16 01:35:31 -05:00
committed by Rapptz
parent 883ae8fe80
commit 9c5259afd7
4 changed files with 86 additions and 24 deletions

View File

@ -26,10 +26,10 @@ DEALINGS IN THE SOFTWARE.
from enum import Enum, IntEnum
__all__ = ['ChannelType', 'MessageType', 'VoiceRegion', 'VerificationLevel',
'ContentFilter', 'Status', 'DefaultAvatar', 'RelationshipType',
'AuditLogAction', 'AuditLogActionCategory', 'UserFlags',
'ActivityType', 'HypeSquadHouse', 'NotificationLevel']
__all__ = ['ChannelType', 'MessageType', 'VoiceRegion', 'SpeakingState',
'VerificationLevel', 'ContentFilter', 'Status', 'DefaultAvatar',
'RelationshipType', 'AuditLogAction', 'AuditLogActionCategory',
'UserFlags', 'ActivityType', 'HypeSquadHouse', 'NotificationLevel']
class ChannelType(Enum):
text = 0
@ -75,6 +75,15 @@ class VoiceRegion(Enum):
def __str__(self):
return self.value
class SpeakingState(IntEnum):
none = 0
voice = 1
soundshare = 2
priority = 4
def __str__(self):
return self.name
class VerificationLevel(IntEnum):
none = 0
low = 1