diff options
| author | Adelyn Breedlove <[email protected]> | 2018-11-10 20:45:33 +0000 |
|---|---|---|
| committer | Adelyn Breedlove <[email protected]> | 2018-11-10 20:45:33 +0000 |
| commit | 5a37b7fcebc27679a75d003feb47a733f608993e (patch) | |
| tree | 900f064176e0a0d748d3773db81dda54646604cd | |
| parent | Merge branch 'dev' into 'master' (diff) | |
| parent | Add test executable to repo (diff) | |
| download | disml-5a37b7fcebc27679a75d003feb47a733f608993e.tar.xz disml-5a37b7fcebc27679a75d003feb47a733f608993e.zip | |
Merge branch 'dev' into 'master'
Add test executable to repo
See merge request Mishio595/animus!2
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | bin/README.md | 1 | ||||
| -rw-r--r-- | bin/bot.ml | 30 |
3 files changed, 32 insertions, 2 deletions
@@ -1,3 +1,2 @@ .merlin -_build/ -bin/
\ No newline at end of file +_build/
\ No newline at end of file diff --git a/bin/README.md b/bin/README.md new file mode 100644 index 0000000..b1315e8 --- /dev/null +++ b/bin/README.md @@ -0,0 +1 @@ +# This is a test executable
\ No newline at end of file diff --git a/bin/bot.ml b/bin/bot.ml new file mode 100644 index 0000000..c08218d --- /dev/null +++ b/bin/bot.ml @@ -0,0 +1,30 @@ +open Lwt.Infix +open Animus + +let _ = + let data = Lwt_main.run (Http.get_gateway_bot ()) in + (* Yojson.Basic.pretty_print Format.std_formatter data; + print_newline (); *) + let url, _shards = match data with + | `Assoc [ + ("url", `String url); + ("shards", `Int shards); + _ + ] -> (url, shards) + | _ -> ("wss://gateway.discord.gg/", 1) + in + (Sharder.Shard.create { + url; + shards = [0; 1;]; + token = Sys.getenv "DISCORD_TOKEN"; + } + >|= fun (shard, recv_loop) -> + Lwt_engine.on_timer 60.0 true @@ begin + fun _ev -> Sharder.Shard.set_status shard + ("Current seq: " ^ string_of_int shard.seq) + >|= (fun _ -> print_endline "Status set!") + |> ignore; + end + |> ignore; + Lwt_main.run recv_loop) + |> Lwt_main.run
\ No newline at end of file |