diff options
| author | Matias Goldfeld <[email protected]> | 2021-01-27 02:30:17 -0500 |
|---|---|---|
| committer | Matias Goldfeld <[email protected]> | 2021-01-27 02:30:17 -0500 |
| commit | 8563506d415d8d26f6d98442e08c55dc0e89e7ec (patch) | |
| tree | 1b5d11f28fea0415eb45f0ebc1186368691f6dad /lib/models | |
| parent | Updated CI image from outdated ocaml/opam2 to ocaml/opam (diff) | |
| download | disml-8563506d415d8d26f6d98442e08c55dc0e89e7ec.tar.xz disml-8563506d415d8d26f6d98442e08c55dc0e89e7ec.zip | |
Fixed sending file attachments by adding multiform support
Diffstat (limited to 'lib/models')
| -rw-r--r-- | lib/models/channel/message/message.ml | 4 | ||||
| -rw-r--r-- | lib/models/channel/message/message.mli | 4 | ||||
| -rw-r--r-- | lib/models/id/channel_id.ml | 8 | ||||
| -rw-r--r-- | lib/models/id/channel_id.mli | 2 |
4 files changed, 7 insertions, 11 deletions
diff --git a/lib/models/channel/message/message.ml b/lib/models/channel/message/message.ml index 41174e1..38c9242 100644 --- a/lib/models/channel/message/message.ml +++ b/lib/models/channel/message/message.ml @@ -50,8 +50,8 @@ let unpin msg = let reply msg content =
Channel_id.say content msg.channel_id
-let reply_with ?embed ?content ?file ?tts msg =
- Channel_id.send_message ?embed ?content ?file ?tts msg.channel_id
+let reply_with ?embed ?content ?files ?tts msg =
+ Channel_id.send_message ?embed ?content ?files ?tts msg.channel_id
let set_content msg cont =
let `Message_id id = msg.id in
diff --git a/lib/models/channel/message/message.mli b/lib/models/channel/message/message.mli index 0eba3af..e0a789a 100644 --- a/lib/models/channel/message/message.mli +++ b/lib/models/channel/message/message.mli @@ -23,11 +23,11 @@ val unpin : t -> unit Deferred.Or_error.t (** Sugar for [Channel_id.say msg.channel_id content]. *)
val reply : t -> string -> t Deferred.Or_error.t
-(** Sugar for [Channel_id.send_message ?embed ?content ?file ?tts msg.channel_id]. *)
+(** Sugar for [Channel_id.send_message ?embed ?content ?files ?tts msg.channel_id]. *)
val reply_with :
?embed:Embed.t ->
?content:string ->
- ?file:string ->
+ ?files:(string * string) list ->
?tts:bool ->
t ->
Message_t.t Deferred.Or_error.t
diff --git a/lib/models/id/channel_id.ml b/lib/models/id/channel_id.ml index 1017ad1..1aa3fbb 100644 --- a/lib/models/id/channel_id.ml +++ b/lib/models/id/channel_id.ml @@ -4,23 +4,19 @@ include Channel_id_t exception Invalid_message
exception No_message_found
-let send_message ?embed ?content ?file ?(tts=false) ch =
+let send_message ?embed ?content ?files ?(tts=false) ch =
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 Invalid_message
| _ -> () in
- Http.create_message (get_id ch) (`Assoc [
+ Http.create_message ?files (get_id ch) (`Assoc [
("embed", embed);
("content", content);
- ("file", file);
("tts", `Bool tts);
])
diff --git a/lib/models/id/channel_id.mli b/lib/models/id/channel_id.mli index 74010a5..a05d282 100644 --- a/lib/models/id/channel_id.mli +++ b/lib/models/id/channel_id.mli @@ -24,7 +24,7 @@ Client.message_create := check_command val send_message :
?embed:Embed.t ->
?content:string ->
- ?file:string ->
+ ?files:(string * string) list ->
?tts:bool ->
t ->
Message_t.t Deferred.Or_error.t
|