All Projects → Mishio595 → disml

Mishio595 / disml

Licence: MIT license
Pure OCaml bindings to the Discord API. Mirror of Gitlab repo.

Programming Languages

ocaml
1615 projects
Standard ML
205 projects

Projects that are alternatives of or similar to disml

Haxicord
The most popular discord API Haxe library (because no others are good enough to be called a library)
Stars: ✭ 42 (+16.67%)
Mutual labels:  discord-api, discord-library, discord-lib
arcscord
A Discord library written in typescript
Stars: ✭ 18 (-50%)
Mutual labels:  discord-api, discord-library
racket-cord
A discord library for racket
Stars: ✭ 24 (-33.33%)
Mutual labels:  discord-api, discord-lib
discord-rose
The simple Discord library for advanced users
Stars: ✭ 37 (+2.78%)
Mutual labels:  discord-api, discord-library
Discord-Selfbot
Discord.js selfbot
Stars: ✭ 24 (-33.33%)
Mutual labels:  discord-api, discord-library
Discord.CPP
Discord.CPP is a C++ library for interaction with the Discord API.
Stars: ✭ 46 (+27.78%)
Mutual labels:  discord-api, discord-library
Disqord
An asynchronous Discord API wrapper for .NET.
Stars: ✭ 155 (+330.56%)
Mutual labels:  discord-api, discord-library
MaSH
A minimalistic Discord API wrapper made in Posix Shell
Stars: ✭ 22 (-38.89%)
Mutual labels:  discord-api, discord-library
QDiscord
QDiscord - An unofficial C++ and Qt wrapper for the Discord API.
Stars: ✭ 21 (-41.67%)
Mutual labels:  discord-api, discord-library
calamity
A library for writing discord bots in haskell
Stars: ✭ 77 (+113.89%)
Mutual labels:  discord-api, discord-library
library
🐍 A Python library for Discord.
Stars: ✭ 648 (+1700%)
Mutual labels:  discord-api, discord-library
Spacebot
An open-source, multipurpose, configurable discord bot that does it all (that's the plan, at least)
Stars: ✭ 41 (+13.89%)
Mutual labels:  discord-api
lacord
A low level, lightweight discord API library.
Stars: ✭ 5 (-86.11%)
Mutual labels:  discord-library
slash-commands
slash commands handler to make your bot support slash commands.
Stars: ✭ 59 (+63.89%)
Mutual labels:  discord-api
hata
Async Discord API wrapper.
Stars: ✭ 156 (+333.33%)
Mutual labels:  discord-api
drone-discord
Drone plugin for sending message to Discord channel using Webhook
Stars: ✭ 34 (-5.56%)
Mutual labels:  discord-api
Hurricano
An amazing open-source Discord bot using MongoDB with many features such as a customizable prefix, a reaction menu, music, role requirement giveaways and much more!
Stars: ✭ 97 (+169.44%)
Mutual labels:  discord-api
DiscordBot-Template
A bot template with command , event , button , selectmenus , slashcommands handler and error handlers. Made in Discord.JS V13
Stars: ✭ 131 (+263.89%)
Mutual labels:  discord-api
Luki
[Deprecated] The official repository for Luki the Discord bot
Stars: ✭ 21 (-41.67%)
Mutual labels:  discord-api
SkyBot
SkyBot is an LGBT-friendly discord bot with music and mod commands written in JDA
Stars: ✭ 37 (+2.78%)
Mutual labels:  discord-api

Dis.ml - An OCaml library for interfacing with the Discord API

This is a library for creating bots on Discord. Dis.ml uses JaneStreet's Async and Core libs and I highly recommend having a solid understanding of both of these before using this library.

Docs can be found here or generated using odoc and dune with dune build @doc


State of the project

What is implemented?

  • The full Discord REST API (Exposed through Disml.Http with abstractions on various models)
  • Complete gateway support (sans voice)
  • Automatic and manual sharding
  • Event dispatch to a user-defined consumer that can be changed at runtime
  • Automatic reconnection of dropped gateway connections, using RESUME when possible
  • Automatic rate limit handling for REST requests
  • Cache

What is not implemented?

  • Abstractions for Discord Objects (Mostly Completed)
  • Voice

Getting started

In order to get started you'll first need to install OCaml (of course). I recommend using OPAM and Dune as a package manager and build tool respectively.

As of release 0.2.5 (12 February 2019), disml is published on OPAM and installable by running

opam install disml

If you would like to use the development version, run

opam pin add disml --dev-repo

Note: The dev repo relies on being pinned to the latest ppx_deriving_yojson due to breaking changes in yojson.1.6.0. You can pin the package with opam pin add ppx_deriving_yojson --dev-repo

If you do not use opam, see disml.opam for build instructions.

You'll find an example bot in /bin directory.


Examples

Robust example

/bin/bot.ml Note: I use this for most of my testing involving API compat, so you'll likely see some bizarre commands.

Basic example

open Async
open Core
open Disml
open Models

(* Create a function to handle message_create. *)
let check_command (message:Message.t) =
    if String.is_prefix ~prefix:"!ping" message.content then
        Message.reply message "Pong!" >>> ignore

let main () =
    (* Register the event handler *)
    Client.message_create := check_command;
    (* Start the client. It's recommended to load the token from an env var or other config file. *)
    Client.start "My token" >>> ignore

let _ =
    (* Launch the Async scheduler. You must do this for anything to work. *)
    Scheduler.go_main ~main ()
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].