discord-haskell-voice-2.1.0: Voice support for discord-haskell.
Copyright(c) Yuto Takano (2021)
LicenseMIT
Maintainermoa17stock@gmail.com
Safe HaskellNone
LanguageHaskell2010

Discord.Internal.Types.VoiceCommon

Description

WARNING

This module is considered internal.

The Package Versioning Policy does not apply.

The contents of this module may change in any way whatsoever and without any warning between minor versions of this package.

Description

This module defines the types for handles, errors, base monads, and other types applicable to both the UPD and Websocket components of the Voice API. Many of the structures defined in this module have Lenses derived for them using Template Haskell.

Synopsis

Documentation

type Voice = ReaderT DiscordBroadcastHandle (ExceptT VoiceError DiscordHandler) Source #

Voice is a type synonym for a ReaderT and ExceptT composition of monad transformers over the DiscordHandler monad. It holds references to voice connections/threads. The content of the reader handle is strictly internal, and is entirely subject to change irrespective of the Package Versioning Policy. Voice is still provided as a type synonym rather than a newtype to take advantage of existing instances for various type-classes.

Developer Note: ExceptT is on the base rather than ReaderT, so that when a critical exception/error occurs in Voice, it can propagate down the transformer stack, kill the threads referenced in the Reader state as necessary, and halt the entire computation and return to DiscordHandler. If ExceptT were on top of ReaderT, then errors would be swallowed before it propagates below ReaderT, and the monad would not halt there, continuing computation with an unstable state.

data VoiceError Source #

VoiceError represents the potential errors when initialising a voice connection. It does not account for errors that occur after the initial handshake (technically, because they are in IO and not ExceptT).

Instances

Instances details
Eq VoiceError Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

Show VoiceError Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

data SubprocessException Source #

SubprocessException is an Exception that may be thrown when a subprocess such as FFmpeg encounters an error.

TODO: This has never actually been seen, so it's untested whether it works.

data DiscordVoiceHandle Source #

DiscordVoiceHandle represents the handles for a single voice connection (to a specific voice channel).

Lenses are defined for this type using Template Haskell.

Constructors

DiscordVoiceHandle 

Fields

data DiscordBroadcastHandle Source #

DiscordBroadcastHandle represents a "stream" or a "broadcast", which is a mutable list of voice connection handles that share the same audio stream.

Lenses are defined for this type using Template Haskell.

Constructors

DiscordBroadcastHandle 

Fields

data WebsocketLaunchOpts Source #

WebsocketLaunchOpts represents all the data necessary to start a Websocket connection to Discord's Voice Gateway.

Lenses are defined for this type using Template Haskell.

Instances

Instances details
HasGuildId WebsocketLaunchOpts GuildId Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

HasToken WebsocketLaunchOpts Text Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

HasSessionId WebsocketLaunchOpts Text Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

HasEndpoint WebsocketLaunchOpts Text Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

HasBotUserId WebsocketLaunchOpts UserId Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

HasLaunchOpts WebsocketConn WebsocketLaunchOpts Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

HasSsrc WebsocketLaunchOpts (MVar Integer) Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

HasUdpTid WebsocketLaunchOpts (MVar (Weak ThreadId)) Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

HasGatewayEvents WebsocketLaunchOpts (Chan (Either GatewayException Event)) Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

HasWsHandle WebsocketLaunchOpts (VoiceWebsocketReceiveChan, VoiceWebsocketSendChan) Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

HasUdpHandle WebsocketLaunchOpts (VoiceUDPReceiveChan, VoiceUDPSendChan) Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

data WebsocketConn Source #

WebsocketConn represents an active connection to Discord's Voice Gateway websocket, and contains the Connection as well as the options that launched it.

Lenses are defined for this type using Template Haskell.

data UDPLaunchOpts Source #

UDPLaunchOpts represents all the data necessary to start a UDP connection to Discord. Field names for this ADT are cased weirdly because I want to keep the UDP part uppercase in the type and data constructor. Since field accessors are rarely used anyway (lenses are preferred instead), we can write the field prefixes as "uDP" and take advantage of Lenses as normal.

Lenses are defined for this type using Template Haskell.

data UDPConn Source #

UDPConn represents an active UDP connection to Discord, and contains the Socket as well as the options that launched it.

Lenses are defined for this type using Template Haskell.

class HasChannelId s a | s -> a where Source #

Methods

channelId :: Lens' s a Source #

class HasMutEx s a | s -> a where Source #

Methods

mutEx :: Lens' s a Source #

Instances

Instances details
HasMutEx DiscordBroadcastHandle (MVar ()) Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

class HasBotUserId s a | s -> a where Source #

Methods

botUserId :: Lens' s a Source #

class HasEndpoint s a | s -> a where Source #

Methods

endpoint :: Lens' s a Source #

class HasSessionId s a | s -> a where Source #

Methods

sessionId :: Lens' s a Source #

class HasToken s a | s -> a where Source #

Methods

token :: Lens' s a Source #

Instances

Instances details
HasToken WebsocketLaunchOpts Text Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

class HasUdpTid s a | s -> a where Source #

Methods

udpTid :: Lens' s a Source #

class HasConnection s a | s -> a where Source #

Methods

connection :: Lens' s a Source #

class HasIp s a | s -> a where Source #

Methods

ip :: Lens' s a Source #

Instances

Instances details
HasIp UDPLaunchOpts Text Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

class HasMode s a | s -> a where Source #

Methods

mode :: Lens' s a Source #

Instances

Instances details
HasMode UDPLaunchOpts Text Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

class HasPort s a | s -> a where Source #

Methods

port :: Lens' s a Source #

Instances

Instances details
HasPort UDPLaunchOpts Integer Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

class HasSecretKey s a | s -> a where Source #

Methods

secretKey :: Lens' s a Source #

Instances

Instances details
HasSecretKey UDPLaunchOpts (MVar [Word8]) Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon

class HasSocket s a | s -> a where Source #

Methods

socket :: Lens' s a Source #

Instances

Instances details
HasSocket UDPConn Socket Source # 
Instance details

Defined in Discord.Internal.Types.VoiceCommon