aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAdelyn Breelove <[email protected]>2018-12-14 11:53:25 -0700
committerAdelyn Breelove <[email protected]>2018-12-14 11:53:25 -0700
commit4df67b173aa7d51f5bd2ce95e476d130a6f93fd6 (patch)
tree3a351748ad4053e62a1efbcbb8624f14073a2a96 /bin
parentAdd a helper script for working with atdgen (diff)
downloaddisml-4df67b173aa7d51f5bd2ce95e476d130a6f93fd6.tar.xz
disml-4df67b173aa7d51f5bd2ce95e476d130a6f93fd6.zip
Working and pretty message replying!
Diffstat (limited to 'bin')
-rw-r--r--bin/handler.ml10
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/handler.ml b/bin/handler.ml
index 8ed55a6..74eaefb 100644
--- a/bin/handler.ml
+++ b/bin/handler.ml
@@ -1,9 +1,13 @@
module Make(Models : Disml.S.Models) = struct
- (* open Core *)
+ open Core
open Async
- (* open Models *)
+ open Models
open Disml.Event
+ let check_command (msg:Disml.Message_t.t) =
+ if String.is_prefix ~prefix:"!ping" msg.content then
+ Message.reply msg "Hello!" >>> ignore
+
let handle_event = function
| HELLO _ -> print_endline "Received HELLO"
| READY _ -> print_endline "Received READY"
@@ -27,7 +31,7 @@ module Make(Models : Disml.S.Models) = struct
| GUILD_ROLE_CREATE _ -> print_endline "Received GUILD_ROLE_CREATE"
| GUILD_ROLE_UPDATE _ -> print_endline "Received GUILD_ROLE_UPDATE"
| GUILD_ROLE_DELETE _ -> print_endline "Received GUILD_ROLE_DELETE"
- | MESSAGE_CREATE _ -> print_endline "Received MESSAGE_CREATE"
+ | MESSAGE_CREATE msg -> check_command msg; print_endline "Received MESSAGE_CREATE"
| MESSAGE_UPDATE _ -> print_endline "Received MESSAGE_UPDATE"
| MESSAGE_DELETE _ -> print_endline "Received MESSAGE_DELETE"
| MESSAGE_BULK_DELETE _ -> print_endline "Received MESSAGE_BULK_DELETE"