diff options
| author | Adelyn Breelove <[email protected]> | 2019-01-30 08:49:35 -0700 |
|---|---|---|
| committer | Adelyn Breelove <[email protected]> | 2019-01-30 08:49:35 -0700 |
| commit | ec15ba6be9ab1f5c7f01190e5beda50f7813a15d (patch) | |
| tree | fdd6fbbab6d77eff5a2e755f568336a77da4f993 | |
| parent | Lol I broke my build file (diff) | |
| download | disml-ec15ba6be9ab1f5c7f01190e5beda50f7813a15d.tar.xz disml-ec15ba6be9ab1f5c7f01190e5beda50f7813a15d.zip | |
Update README
| -rw-r--r-- | README.md | 30 |
1 files changed, 27 insertions, 3 deletions
@@ -8,12 +8,12 @@ Docs can be found [here](https://mishio595.gitlab.io/disml). Latest changes are on master #### What is implemented? -* The full Discord REST API +* 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 -* Automatic rate limit handling +* Automatic reconnection of dropped gateway connections, using RESUME when possible +* Automatic rate limit handling for REST requests #### What is not implemented? * Abstractions for Discord Objects (**Mostly Completed**) @@ -26,3 +26,27 @@ In order to get started you'll first need to install OCaml (of course). I recomm The project is not currently uploaded to opam. This will happen with the first stable release. If you do not use opam, see `disml.opam` for build instructions. You'll find an example bot in /bin directory. + +### Barebones example + +```ocaml +open Async +open Core +open Disml +open Models + +(* Create a function to handle message_create. *) +let check_command (Event.MessageCreate.{message}) = + 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 () +```
\ No newline at end of file |