Skip to content

brokenprogrammer/BrokenDiscord

Repository files navigation

BrokenDiscord Build Status NuGet

BrokenDiscord is a Discord API Library written in F#. The main purpose is to provide a functional alternative that is both clean and easy to use.

Installation

The library is available through NuGet.

Usage

The classic ping pong example can be found here. More examples will be added in the future.

First you want to import the following modules

    open BrokenDiscord.Client
    open BrokenDiscord.Types
    open BrokenDiscord.Events
    open Hopac

You can then construct a new Discord client which can be used to access both the Discord web API and set callbacks for Discord events.

let client = new Client("DISCORD_BOT_TOKEN_HERE")

In the main function of the program you can add event handlers to the client and then call the start function to start the client which will then connect to the Discord gateway using a websocket.

    // Add functionality for reacting to events here
    let handleEvents = function
        | Ready args -> ()
        | MessageCreate args -> ()
        | TypingStart args -> ()
        | _ -> ()

    [<EntryPoint>]
    let main argv =
        client.Events |> Event.add handleEvents
        client.start()
        Console.ReadLine() |> ignore 
        0

Contributors

Releases

No releases published

Packages

 
 
 

Languages