diff options
Diffstat (limited to 'lib/models')
| -rw-r--r-- | lib/models/message.ml | 12 | ||||
| -rw-r--r-- | lib/models/message.mli | 18 |
2 files changed, 20 insertions, 10 deletions
diff --git a/lib/models/message.ml b/lib/models/message.ml index 6cb54b4..5bc06b7 100644 --- a/lib/models/message.ml +++ b/lib/models/message.ml @@ -1,3 +1,4 @@ +open Core open Async include Message_t @@ -7,6 +8,7 @@ let add_reaction msg (emoji:Emoji.t) = | None -> emoji.name in Http.create_reaction msg.channel_id msg.id e + >>| Result.map ~f:ignore let remove_reaction msg (emoji:Emoji.t) (user:User_t.t) = let e = match emoji.id with @@ -14,27 +16,35 @@ let remove_reaction msg (emoji:Emoji.t) (user:User_t.t) = | None -> emoji.name in Http.delete_reaction msg.channel_id msg.id e user.id + >>| Result.map ~f:ignore let clear_reactions msg = Http.delete_reactions msg.channel_id msg.id + >>| Result.map ~f:ignore let delete msg = Http.delete_message msg.channel_id msg.id + >>| Result.map ~f:ignore let pin msg = Http.pin_message msg.channel_id msg.id + >>| Result.map ~f:ignore let unpin msg = Http.unpin_message msg.channel_id msg.id + >>| Result.map ~f:ignore let reply msg cont = let rep = `Assoc [("content", `String cont)] in Http.create_message msg.channel_id rep + >>| 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 + >>| Result.map ~f:Message_t.of_yojson_exn let set_embed msg embed = to_yojson { msg with embeds = [embed]; } - |> Http.edit_message msg.channel_id msg.id
\ No newline at end of file + |> Http.edit_message msg.channel_id msg.id + >>| Result.map ~f:Message_t.of_yojson_exn
\ No newline at end of file diff --git a/lib/models/message.mli b/lib/models/message.mli index 040eb5e..40c87d4 100644 --- a/lib/models/message.mli +++ b/lib/models/message.mli @@ -2,12 +2,12 @@ open Async include module type of Message_t -val add_reaction : t -> Emoji.t -> Yojson.Safe.json Deferred.Or_error.t -val remove_reaction : t -> Emoji.t -> User_t.t -> Yojson.Safe.json Deferred.Or_error.t -val clear_reactions : t -> Yojson.Safe.json Deferred.Or_error.t -val delete : t -> Yojson.Safe.json Deferred.Or_error.t -val pin : t -> Yojson.Safe.json Deferred.Or_error.t -val unpin : t -> Yojson.Safe.json Deferred.Or_error.t -val reply : t -> string -> Yojson.Safe.json Deferred.Or_error.t -val set_content : t -> string -> Yojson.Safe.json Deferred.Or_error.t -val set_embed : t -> Embed.t -> Yojson.Safe.json Deferred.Or_error.t
\ No newline at end of file +val add_reaction : t -> Emoji.t -> unit Deferred.Or_error.t +val remove_reaction : t -> Emoji.t -> User_t.t -> unit Deferred.Or_error.t +val clear_reactions : t -> unit Deferred.Or_error.t +val delete : t -> unit Deferred.Or_error.t +val pin : t -> unit Deferred.Or_error.t +val unpin : t -> unit Deferred.Or_error.t +val reply : t -> string -> t Deferred.Or_error.t +val set_content : t -> string -> t Deferred.Or_error.t +val set_embed : t -> Embed.t -> t Deferred.Or_error.t
\ No newline at end of file |