aboutsummaryrefslogtreecommitdiff
path: root/lib/models/channel/channel.mli
blob: 94022e7f036154cd084a22df79c4f6e42cae1768 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
include module type of Channel_t

exception Invalid_message
exception No_message_found

(** Advanced message sending.

    Raises {!Invalid_message} if one of content or embed is not set.

    {3 Examples}
    {[
open Core
open Disml

let check_command (msg : Message.t) =
    if String.is_prefix ~prefix:"!hello" msg.content then
        let embed = Embed.(default |> title "Hello World!") in
        Channel_id.send_message ~embed msg.channel_id >>> ignore

Client.message_create := check_command
    ]}
*)
val send_message :
    ?embed:Embed.t ->
    ?content:string ->
    ?file:string ->
    ?tts:bool ->
    t ->
    (Message_t.t, string) Lwt_result.t

(** [say str ch] is equivalent to [send_message ~content:str ch]. *)
val say : string -> t -> (Message_t.t, string) Lwt_result.t

val delete : t -> (Channel_t.t, string) Lwt_result.t
val get_message : id:Snowflake.t -> t -> (Message_t.t, string) Lwt_result.t
val get_messages :
    ?mode:[ `Before | `After | `Around ] ->
    ?id:Snowflake.t ->
    ?limit:int ->
    t ->
    (Message_t.t list, string) Lwt_result.t
val broadcast_typing : t -> (unit, string) Lwt_result.t
val get_pins : t -> (Message_t.t list, string) Lwt_result.t
val bulk_delete : Snowflake.t list -> t -> (unit, string) Lwt_result.t
(* TODO more things related to guild channels *)