diff options
| author | Mishio595 <[email protected]> | 2018-11-10 13:44:47 -0700 |
|---|---|---|
| committer | Mishio595 <[email protected]> | 2018-11-10 13:44:47 -0700 |
| commit | 3dd7010fd1c03619069320d5ab5d4e7ca4969f44 (patch) | |
| tree | 900f064176e0a0d748d3773db81dda54646604cd /bin | |
| parent | Fix to sharding changes (diff) | |
| download | disml-3dd7010fd1c03619069320d5ab5d4e7ca4969f44.tar.xz disml-3dd7010fd1c03619069320d5ab5d4e7ca4969f44.zip | |
Add test executable to repo
Diffstat (limited to 'bin')
| -rw-r--r-- | bin/README.md | 1 | ||||
| -rw-r--r-- | bin/bot.ml | 30 |
2 files changed, 31 insertions, 0 deletions
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 |