aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdelyn Breedlove <[email protected]>2019-01-20 21:10:03 -0700
committerAdelyn Breedlove <[email protected]>2019-01-20 21:10:03 -0700
commit8cc616e0878d9209c383b15863998ce975da4425 (patch)
tree08389f16a387dedda52e0ab0da5229ae522d5729
parentmore updates (diff)
downloaddisml-8cc616e0878d9209c383b15863998ce975da4425.tar.xz
disml-8cc616e0878d9209c383b15863998ce975da4425.zip
Add embed builders
-rw-r--r--bin/bot.ml7
-rw-r--r--lib/models/embed.ml17
2 files changed, 21 insertions, 3 deletions
diff --git a/bin/bot.ml b/bin/bot.ml
index 05d836d..d0a8218 100644
--- a/bin/bot.ml
+++ b/bin/bot.ml
@@ -30,7 +30,12 @@ let check_command (msg:Message.t) =
|> Int.to_string in
Message.reply msg list >>> ignore
| "!embed" ->
- let embed = { Embed.default with description = Some "Hello World!" } in
+ let embed = Embed.(default
+ |> title "Foo"
+ |> description "Bar"
+ |> colour 0xff
+ |> field { name = "field"; value = "test"; inline = true; }
+ ) in
Message.reply_with ~embed msg >>> ignore
| _ -> ()
diff --git a/lib/models/embed.ml b/lib/models/embed.ml
index 7dbbeaa..23c8607 100644
--- a/lib/models/embed.ml
+++ b/lib/models/embed.ml
@@ -43,7 +43,7 @@ type t = {
description: string option [@default None];
url: string option [@default None];
timestamp: string option [@default None];
- colour: int option [@default None];
+ colour: int option [@default None][@key "color"];
footer: footer option [@default None];
image: image option [@default None];
thumbnail: image option [@default None];
@@ -67,4 +67,17 @@ let default = {
provider = None;
author = None;
fields = [];
-} \ No newline at end of file
+}
+
+let title v e = { e with title = Some v }
+let description v e = { e with description = Some v }
+let url v e = { e with url = Some v }
+let timestamp v e = { e with timestamp = Some v }
+let colour v e = { e with colour = Some v }
+let color v e = { e with colour = Some v }
+let footer v e = { e with footer = Some v }
+let image v e = { e with image = Some v }
+let thumbnail v e = { e with thumbnail = Some v }
+let author v e = { e with author = Some v }
+let field v e = { e with fields = v::e.fields }
+let fields v e = { e with fields = v } \ No newline at end of file