aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAdelyn Breelove <[email protected]>2018-11-29 12:55:10 -0700
committerAdelyn Breelove <[email protected]>2018-11-29 12:55:10 -0700
commit473072f66e6c7e228b4f26730cbc7304941fb12b (patch)
treecd689e7f53bafbf357c8be88e317251b2a4b7539 /bin
parentClean up a bit (diff)
downloaddisml-473072f66e6c7e228b4f26730cbc7304941fb12b.tar.xz
disml-473072f66e6c7e228b4f26730cbc7304941fb12b.zip
functors!
Diffstat (limited to 'bin')
-rw-r--r--bin/bot.ml13
1 files changed, 7 insertions, 6 deletions
diff --git a/bin/bot.ml b/bin/bot.ml
index 329c22d..92825fc 100644
--- a/bin/bot.ml
+++ b/bin/bot.ml
@@ -1,6 +1,11 @@
open Async
open Core
-open Disml
+
+module Client = Disml.Client.Make(struct
+ let token = match Sys.getenv "DISCORD_TOKEN" with
+ | Some t -> t
+ | None -> failwith "No token in env"
+end)
(* let rec ev_loop read =
Pipe.read read >>= fun frame ->
@@ -38,12 +43,8 @@ open Disml
>>= fun _ -> ev_loop read *)
let main () =
- let token = match Sys.getenv "DISCORD_TOKEN" with
- | Some s -> s
- | None -> failwith "No token"
- in
let (_r,w) = Pipe.create () in
- let client = Client.create ~handler:w token in
+ let client = Client.init ~handler:w () in
(* ev_loop r >>> ignore; *)
Client.start client
>>> fun client ->