aboutsummaryrefslogtreecommitdiff
path: root/bin/bot.ml
diff options
context:
space:
mode:
authorMishio595 <[email protected]>2018-11-17 19:49:45 -0700
committerMishio595 <[email protected]>2018-11-17 19:49:45 -0700
commitd92fe94da312c0a69dbe9bd7c2e525c594f20e40 (patch)
treeccd4a634996d97e4ba89f92cd904fbb0632f2fa4 /bin/bot.ml
parentstupid dune-project file... (diff)
downloaddisml-d92fe94da312c0a69dbe9bd7c2e525c594f20e40.tar.xz
disml-d92fe94da312c0a69dbe9bd7c2e525c594f20e40.zip
Rewrite from Lwt to Async
Diffstat (limited to 'bin/bot.ml')
-rw-r--r--bin/bot.ml25
1 files changed, 9 insertions, 16 deletions
diff --git a/bin/bot.ml b/bin/bot.ml
index bf9f36e..34f24ea 100644
--- a/bin/bot.ml
+++ b/bin/bot.ml
@@ -1,20 +1,13 @@
-open Lwt.Infix
+open Async
open Disml
-let main sharder =
- Lwt_engine.on_timer 60.0 true begin
- fun _ev -> Sharder.set_status_with sharder @@ begin
- fun shard ->
- `String ("Current seq: " ^ string_of_int shard.seq)
- end
- >|= (fun _ -> print_endline "Status set!")
- |> ignore;
- end
+let main () =
+ let token = match Sys.getenv "DISCORD_TOKEN" with
+ | Some s -> s
+ | None -> failwith "No token"
+ in
+ Sharder.start token
+ |> ignore
let _ =
- Sharder.start @@ Sys.getenv "DISCORD_TOKEN"
- >>= (fun sharder ->
- main sharder
- |> ignore;
- sharder.promise)
- |> Lwt_main.run \ No newline at end of file
+ Scheduler.go_main ~main:(main) () \ No newline at end of file