From b2f081fff12093a7d3434859ebd621608dde6c7d Mon Sep 17 00:00:00 2001 From: Matias Goldfeld Date: Sun, 7 Feb 2021 20:21:47 -0500 Subject: Reverted earlier changes for good --- lib/models/id/channel_id.ml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'lib/models/id/channel_id.ml') diff --git a/lib/models/id/channel_id.ml b/lib/models/id/channel_id.ml index 6c08711..1ea7a46 100644 --- a/lib/models/id/channel_id.ml +++ b/lib/models/id/channel_id.ml @@ -6,7 +6,7 @@ exception No_message_found let send_message ?embed ?content ?files ?(tts=false) ?reply ch = let embed = match embed with - | Some e -> Embed.yojson_of_t e + | Some e -> Embed.to_yojson e | None -> `Null in let content = match content with | Some c -> `String c @@ -15,7 +15,7 @@ let send_message ?embed ?content ?files ?(tts=false) ?reply ch = | `Null, `Null -> raise Invalid_message | _ -> () in let message_reference = match reply with - | Some m -> `Assoc [("message_id", Message_id.yojson_of_t m)] + | Some m -> `Assoc [("message_id", Message_id.to_yojson m)] | None -> `Null in Http.create_message ?files (get_id ch) (`Assoc [ ("embed", embed); @@ -33,13 +33,16 @@ let delete ch = let get_message ~id ch = Http.get_message (get_id ch) id -let get_messages ?(mode=`Around) ~id ?(limit=50) ch = +let get_messages ?(mode=`Around) ?id ?(limit=50) ch = let kind = match mode with - | `Around -> "around", id - | `Before -> "before", id - | `After -> "after", id + | `Around -> "around", limit + | `Before -> "before", limit + | `After -> "after", limit in - Http.get_messages (get_id ch) limit kind + let id = match id with + | Some id -> id + | None -> raise No_message_found in + Http.get_messages (get_id ch) id kind let broadcast_typing ch = Http.broadcast_typing (get_id ch) @@ -48,5 +51,5 @@ let get_pins ch = Http.get_pinned_messages (get_id ch) let bulk_delete msgs ch = - let msgs = `List (List.map ~f:(fun id -> `Intlit (Int64.to_string id)) msgs) in + let msgs = `List (List.map ~f:(fun id -> `Int id) msgs) in Http.bulk_delete (get_id ch) msgs \ No newline at end of file -- cgit v1.2.3