diff options
| author | Adelyn Breedlove <[email protected]> | 2019-01-19 15:58:31 -0700 |
|---|---|---|
| committer | Adelyn Breedlove <[email protected]> | 2019-01-19 15:58:31 -0700 |
| commit | b678d7312518bb0ff74d7db364bcbbcded5c1609 (patch) | |
| tree | 39094fc179c33fc67269ffc3fea218384c558cfe /lib/models/message.ml | |
| parent | update docs export (diff) | |
| download | disml-b678d7312518bb0ff74d7db364bcbbcded5c1609.tar.xz disml-b678d7312518bb0ff74d7db364bcbbcded5c1609.zip | |
more updates
Diffstat (limited to 'lib/models/message.ml')
| -rw-r--r-- | lib/models/message.ml | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/models/message.ml b/lib/models/message.ml index 5bc06b7..f772c48 100644 --- a/lib/models/message.ml +++ b/lib/models/message.ml @@ -39,6 +39,26 @@ let reply msg cont = Http.create_message msg.channel_id rep >>| Result.map ~f:Message_t.of_yojson_exn +let reply_with ?embed ?content ?file ?(tts=false) msg = + let embed = match embed with + | Some e -> Embed.to_yojson e + | None -> `Null in + let content = match content with + | Some c -> `String c + | None -> `Null in + let file = match file with + | Some f -> `String f + | None -> `Null in + let () = match embed, content with + | `Null, `Null -> raise Channel.Invalid_message + | _ -> () in + Http.create_message (msg.channel_id) (`Assoc [ + ("embed", embed); + ("content", content); + ("file", file); + ("tts", `Bool tts); + ]) >>| Result.map ~f:Message_t.of_yojson_exn + let set_content msg cont = to_yojson { msg with content = cont; } |> Http.edit_message msg.channel_id msg.id |