aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdelyn Breedlove <[email protected]>2019-03-03 20:27:19 -0700
committerAdelyn Breedlove <[email protected]>2019-03-03 20:27:19 -0700
commit131d64e7b8b92ca63608bcfbcd564ec0cb592aa9 (patch)
tree60d7412e911069401ddc3671c643fec22c1482ae
parentIT WORKS (diff)
downloaddisml-131d64e7b8b92ca63608bcfbcd564ec0cb592aa9.tar.xz
disml-131d64e7b8b92ca63608bcfbcd564ec0cb592aa9.zip
Add a restart command
-rw-r--r--bin/bot.ml3
-rw-r--r--bin/commands.ml5
2 files changed, 7 insertions, 1 deletions
diff --git a/bin/bot.ml b/bin/bot.ml
index d28c8be..8be038d 100644
--- a/bin/bot.ml
+++ b/bin/bot.ml
@@ -7,7 +7,7 @@ module String = Base.String
(* Define a function to handle message_create *)
let check_command (message:Message.t) =
(* Simple example of command parsing. *)
- let cmd, rest = match String.split ~on:' ' message.content with
+ let cmd, rest = match String.split ~on:' ' (String.lowercase message.content) with
| hd::tl -> hd, tl
| [] -> "", []
in match cmd with
@@ -19,6 +19,7 @@ let check_command (message:Message.t) =
| "!echo" -> Commands.echo message rest
(* | "!cache" -> Commands.cache message rest *)
| "!shutdown" -> Commands.shutdown message rest
+ | "!restart" -> Commands.restart message rest
| "!rgm" -> Commands.request_members message rest
(* | "!new" -> Commands.new_guild message rest *)
(* | "!delall" -> Commands.delete_guilds message rest *)
diff --git a/bin/commands.ml b/bin/commands.ml
index a278b5d..1becccc 100644
--- a/bin/commands.ml
+++ b/bin/commands.ml
@@ -108,6 +108,11 @@ let shutdown (message:Message.t) _args =
exit 0
else Lwt.return_unit
+let restart (message:Message.t) _args =
+ if message.author.id = `User_id 242675474927583232 then
+ client >>= Client.shutdown_all
+ else Lwt.return_unit
+
(* Request guild members to be sent over the gateway for the guild the command is run in. This will cause multiple GUILD_MEMBERS_CHUNK events. *)
let request_members (message:Message.t) _args =
client >>= fun client ->