discord-haskell-voice: Voice support for discord-haskell.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Supplementary library to discord-haskell. See the project README on GitHub for more information. https://github.com/yutotakano/discord-haskell-voice


[Skip to Readme]

Properties

Versions 2.1.0, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1
Change log ChangeLog.md
Dependencies aeson (==1.5.6.0), async (>=2.2.3 && <2.4), base (>=4.7 && <5), binary (>=0.8 && <0.9), BoundedChan (==1.0.3.0), bytestring (>=0.10.12.0 && <0.11), conduit (==1.3.4.1), discord-haskell (==1.9.2), discord-haskell-voice, lens (>=4.19.2 && <5), mtl (==2.2.2), network (>=3.1.1.1 && <3.2), optparse-applicative (>=0.15.1.0 && <0.17), opus (==0.1.0.0), process (>=1.6.9.0 && <1.7), safe-exceptions (>=0.1.7.1 && <0.1.8), saltine (>=0.1.1.1 && <0.2), stm (>=2.5.0.0 && <2.5.1), stm-containers (==1.2), text (>=1.2.4.1 && <2), time (>=1.9.3 && <=1.13), unliftio (>=0.2.18 && <0.3), websockets (>=0.12.7.2 && <0.12.8), wuss (>=1.1.18 && <=1.2) [details]
License MIT
Copyright 2021 Yuto Takano
Author Yuto Takano
Maintainer moa17stock@gmail.com
Category Network
Home page https://github.com/yutotakano/discord-haskell-voice#readme
Bug tracker https://github.com/yutotakano/discord-haskell-voice/issues
Source repo head: git clone https://github.com/yutotakano/discord-haskell-voice
Uploaded by yutotakano at 2022-01-03T14:42:45Z

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for discord-haskell-voice-2.1.0

[back to package description]

discord-haskell-voice

Welcome to discord-haskell-voice! This library provides you with a high-level interface for interacting with Discord's Voice API, building on top of the discord-haskell library by Karl.

For a quick intuitive introduction to what this library enables you to do, see the following snippet of code:

rickroll :: Channel -> DiscordHandler ()
rickroll c@(ChannelVoice {}) = do
    void $ runVoice $ do
        join (channelGuild c) (channelId c)
        playYouTube "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

The library actively uses and supports conduit, which enables you to write something like the following as well!

rickrollHalfVolume :: Channel -> DiscordHandler ()
rickrollHalfVolume c@(ChannelVoice {}) = do
    void $ runVoice $ do
        join (channelGuild c) (channelId c)        
        let halfAmplitude = awaitForever $ \current ->
                yield $ round $ fromIntegral current * 0.5
        playYouTube' "rickroll" $ packInt16C .| halfAmplitude .| unpackInt16C
        liftIO $ print "finished playing!"

Requirements

Features

What is supported:

What is not supported:

See examples/BasicMusicBot.hs for a bot that uses many advanced features of the library, including dynamically adjusting the stream audio using a TVar (and allowing users to change the TVar using a /volume command).

Documentation

See the Haddock documentation.

Future Plans