diff options
| author | Adelyn Breedlove <[email protected]> | 2019-01-28 10:31:51 -0700 |
|---|---|---|
| committer | Adelyn Breedlove <[email protected]> | 2019-01-28 10:31:51 -0700 |
| commit | 8662e92987c437f59d09896a247ec2b5d82c4528 (patch) | |
| tree | f004cc14598351d4ad6b19d8e993d2f629c5e738 /lib/models/channel/message | |
| parent | Add more docs (diff) | |
| download | disml-8662e92987c437f59d09896a247ec2b5d82c4528.tar.xz disml-8662e92987c437f59d09896a247ec2b5d82c4528.zip | |
Publish docs updates
Diffstat (limited to 'lib/models/channel/message')
| -rw-r--r-- | lib/models/channel/message/attachment.mli | 16 | ||||
| -rw-r--r-- | lib/models/channel/message/embed.ml | 240 | ||||
| -rw-r--r-- | lib/models/channel/message/embed.mli | 254 | ||||
| -rw-r--r-- | lib/models/channel/message/message.ml | 132 | ||||
| -rw-r--r-- | lib/models/channel/message/message.mli | 57 | ||||
| -rw-r--r-- | lib/models/channel/message/message_t.ml | 44 | ||||
| -rw-r--r-- | lib/models/channel/message/message_t.mli | 42 | ||||
| -rw-r--r-- | lib/models/channel/message/reaction_t.ml | 26 | ||||
| -rw-r--r-- | lib/models/channel/message/reaction_t.mli | 26 |
9 files changed, 428 insertions, 409 deletions
diff --git a/lib/models/channel/message/attachment.mli b/lib/models/channel/message/attachment.mli index 2780011..f935471 100644 --- a/lib/models/channel/message/attachment.mli +++ b/lib/models/channel/message/attachment.mli @@ -1,9 +1,9 @@ -type t = { - id: Snowflake.t; - filename: string; - size: int; - url: string; - proxy_url: string; - height: int; - width: int; +type t = {
+ id: Snowflake.t;
+ filename: string;
+ size: int;
+ url: string;
+ proxy_url: string;
+ height: int;
+ width: int;
} [@@deriving sexp, yojson]
\ No newline at end of file diff --git a/lib/models/channel/message/embed.ml b/lib/models/channel/message/embed.ml index 9f9aacd..584d3c7 100644 --- a/lib/models/channel/message/embed.ml +++ b/lib/models/channel/message/embed.ml @@ -1,121 +1,121 @@ -open Core - -type footer = { - text: string; - icon_url: string option [@default None]; - proxy_icon_url: string option [@default None]; -} [@@deriving sexp, yojson] - -type image = { - url: string option [@default None]; - proxy_url: string option [@default None]; - height: int option [@default None]; - width: int option [@default None]; -} [@@deriving sexp, yojson] - -type video = { - url: string option [@default None]; - height: int option [@default None]; - width: int option [@default None]; -} [@@deriving sexp, yojson] - -type provider = { - name: string option [@default None]; - url: string option [@default None]; -} [@@deriving sexp, yojson] - -type author = { - name: string option [@default None]; - url: string option [@default None]; - icon_url: string option [@default None]; - proxy_icon_url: string option [@default None]; -} [@@deriving sexp, yojson] - -type field = { - name: string; - value: string; - inline: bool [@default false]; -} [@@deriving sexp, yojson] - -type t = { - title: string option [@default None]; - kind: string option [@default None][@key "type"]; - description: string option [@default None]; - url: string option [@default None]; - timestamp: string option [@default None]; - colour: int option [@default None][@key "color"]; - footer: footer option [@default None]; - image: image option [@default None]; - thumbnail: image option [@default None]; - video: video option [@default None]; - provider: provider option [@default None]; - author: author option [@default None]; - fields: field list [@default []]; -} [@@deriving sexp, yojson { strict = false }] - -let default = { - title = None; - kind = None; - description = None; - url = None; - timestamp = None; - colour = None; - footer = None; - image = None; - thumbnail = None; - video = None; - provider = None; - author = None; - fields = []; -} - -let default_footer = { - text = ""; - icon_url = None; - proxy_icon_url = None; -} - -let default_image = { - url = None; - proxy_url = None; - height = None; - width = None; -} - -let default_video = { - url = None; - width = None; - height = None; -} - -let default_provider = { - name = None; - url = None; -} - -let default_author = { - name = None; - url = None; - icon_url = None; - proxy_icon_url = None; -} - -let title v e = { e with title = Some v } -let description v e = { e with description = Some v } -let url v e = { e with url = Some v } -let timestamp v e = { e with timestamp = Some v } -let colour v e = { e with colour = Some v } -let color v e = { e with colour = Some v } -let footer f e = { e with footer = Some (f default_footer) } -let image v e = { e with image = Some { default_image with url = Some v } } -let thumbnail v e = { e with thumbnail = Some { default_image with url = Some v } } -let author f e = { e with author = Some (f default_author) } -let field (name, value, inline) e = { e with fields = { name; value; inline; }::e.fields } -let fields l e = { e with fields = List.map ~f:(fun (name, value, inline) -> { name; value; inline; }) l } - -let footer_text v f : footer = { f with text = v } -let footer_icon v f : footer = { f with icon_url = Some v } - -let author_name v a : author = { a with name = Some v } -let author_url v a : author = { a with url = Some v } +open Core
+
+type footer = {
+ text: string;
+ icon_url: string option [@default None];
+ proxy_icon_url: string option [@default None];
+} [@@deriving sexp, yojson]
+
+type image = {
+ url: string option [@default None];
+ proxy_url: string option [@default None];
+ height: int option [@default None];
+ width: int option [@default None];
+} [@@deriving sexp, yojson]
+
+type video = {
+ url: string option [@default None];
+ height: int option [@default None];
+ width: int option [@default None];
+} [@@deriving sexp, yojson]
+
+type provider = {
+ name: string option [@default None];
+ url: string option [@default None];
+} [@@deriving sexp, yojson]
+
+type author = {
+ name: string option [@default None];
+ url: string option [@default None];
+ icon_url: string option [@default None];
+ proxy_icon_url: string option [@default None];
+} [@@deriving sexp, yojson]
+
+type field = {
+ name: string;
+ value: string;
+ inline: bool [@default false];
+} [@@deriving sexp, yojson]
+
+type t = {
+ title: string option [@default None];
+ kind: string option [@default None][@key "type"];
+ description: string option [@default None];
+ url: string option [@default None];
+ timestamp: string option [@default None];
+ colour: int option [@default None][@key "color"];
+ footer: footer option [@default None];
+ image: image option [@default None];
+ thumbnail: image option [@default None];
+ video: video option [@default None];
+ provider: provider option [@default None];
+ author: author option [@default None];
+ fields: field list [@default []];
+} [@@deriving sexp, yojson { strict = false }]
+
+let default = {
+ title = None;
+ kind = None;
+ description = None;
+ url = None;
+ timestamp = None;
+ colour = None;
+ footer = None;
+ image = None;
+ thumbnail = None;
+ video = None;
+ provider = None;
+ author = None;
+ fields = [];
+}
+
+let default_footer = {
+ text = "";
+ icon_url = None;
+ proxy_icon_url = None;
+}
+
+let default_image = {
+ url = None;
+ proxy_url = None;
+ height = None;
+ width = None;
+}
+
+let default_video = {
+ url = None;
+ width = None;
+ height = None;
+}
+
+let default_provider = {
+ name = None;
+ url = None;
+}
+
+let default_author = {
+ name = None;
+ url = None;
+ icon_url = None;
+ proxy_icon_url = None;
+}
+
+let title v e = { e with title = Some v }
+let description v e = { e with description = Some v }
+let url v e = { e with url = Some v }
+let timestamp v e = { e with timestamp = Some v }
+let colour v e = { e with colour = Some v }
+let color v e = { e with colour = Some v }
+let footer f e = { e with footer = Some (f default_footer) }
+let image v e = { e with image = Some { default_image with url = Some v } }
+let thumbnail v e = { e with thumbnail = Some { default_image with url = Some v } }
+let author f e = { e with author = Some (f default_author) }
+let field (name, value, inline) e = { e with fields = { name; value; inline; }::e.fields }
+let fields l e = { e with fields = List.map ~f:(fun (name, value, inline) -> { name; value; inline; }) l }
+
+let footer_text v f : footer = { f with text = v }
+let footer_icon v f : footer = { f with icon_url = Some v }
+
+let author_name v a : author = { a with name = Some v }
+let author_url v a : author = { a with url = Some v }
let author_icon v a : author = { a with icon_url = Some v }
\ No newline at end of file diff --git a/lib/models/channel/message/embed.mli b/lib/models/channel/message/embed.mli index 411d8cc..d30d015 100644 --- a/lib/models/channel/message/embed.mli +++ b/lib/models/channel/message/embed.mli @@ -1,128 +1,128 @@ -(** A footer object belonging to an embed. *) -type footer = { - text: string; - icon_url: string option; - proxy_icon_url: string option; -} [@@deriving sexp, yojson] - -(** An image object belonging to an embed. *) -type image = { - url: string option; - proxy_url: string option; - height: int option; - width: int option; -} [@@deriving sexp, yojson] - -(** A video object belonging to an embed. *) -type video = { - url: string option; - height: int option; - width: int option; -} [@@deriving sexp, yojson] - -(** A provider object belonging to an embed. *) -type provider = { - name: string option; - url: string option; -} [@@deriving sexp, yojson] - -(** An author object belonging to an embed. *) -type author = { - name: string option; - url: string option; - icon_url: string option; - proxy_icon_url: string option; -} [@@deriving sexp, yojson] - -(** A field object belonging to an embed. *) -type field = { - name: string; - value: string; - inline: bool; -} [@@deriving sexp, yojson] - -(** An embed object. See this {{:https://leovoel.github.io/embed-visualizer/}embed visualiser} if you need help understanding each component. *) -type t = { - title: string option; - kind: string option[@key "type"]; - description: string option; - url: string option; - timestamp: string option; - colour: int option[@key "color"]; - footer: footer option; - image: image option; - thumbnail: image option; - video: video option; - provider: provider option; - author: author option; - fields: field list [@default []]; -} [@@deriving sexp, yojson { strict = false }] - -(** An embed where all values are empty. *) -val default : t - -(** A footer where all values are empty. *) -val default_footer : footer - -(** An image where all values are empty. *) -val default_image : image - -(** A video where all values are empty. *) -val default_video : video - -(** A provider where all values are empty. *) -val default_provider : provider - -(** An author where all values are empty. *) -val default_author : author - -(** Set the title of an embed. *) -val title : string -> t -> t - -(** Set the description of an embed. *) -val description : string -> t -> t - -(** Set the URL of an embed. *) -val url : string -> t -> t - -(** Set the timestamp of an embed. *) -val timestamp : string -> t -> t - -(** Set the colour of an embed. *) -val colour : int -> t -> t - -(** Identical to {!colour} but with US English spelling. *) -val color : int -> t -> t - -(** Set the footer of an embed. The function passes {!default_footer} and must return a footer. *) -val footer : (footer -> footer) -> t -> t - -(** Set the image URL of an embed. *) -val image : string -> t -> t - -(** Set the thumbnail URL of an embed. *) -val thumbnail : string -> t -> t - -(** Set the author of an embed. The function passes {!default_author} and must return an author. *) -val author : (author -> author) -> t -> t - -(** Add a field to an embed. Takes a tuple in [(name, value, inline)] order. {b Fields added this way will appear in reverse order in the embed.} *) -val field : string * string * bool -> t -> t - -(** Set the fields of an embed. Similar to {!val:field}, but because a complete list is passed, fields preserve order. *) -val fields : (string * string * bool) list -> t -> t - -(** Set the footer text. Typically used in the closure passed to {!val:footer}. *) -val footer_text : string -> footer -> footer - -(** Set the footer icon URL. Typically used in the closure passed to {!val:footer}. *) -val footer_icon : string -> footer -> footer - -(** Set the author name. Typically used in the closure passed to {!val:author}. *) -val author_name : string -> author -> author - -(** Set the author URL. Typically used in the closure passed to {!val:author}. *) -val author_url : string -> author -> author - -(** Set the author icon URL. Typically used in the closure passed to {!val:author}. *) +(** A footer object belonging to an embed. *)
+type footer = {
+ text: string;
+ icon_url: string option;
+ proxy_icon_url: string option;
+} [@@deriving sexp, yojson]
+
+(** An image object belonging to an embed. *)
+type image = {
+ url: string option;
+ proxy_url: string option;
+ height: int option;
+ width: int option;
+} [@@deriving sexp, yojson]
+
+(** A video object belonging to an embed. *)
+type video = {
+ url: string option;
+ height: int option;
+ width: int option;
+} [@@deriving sexp, yojson]
+
+(** A provider object belonging to an embed. *)
+type provider = {
+ name: string option;
+ url: string option;
+} [@@deriving sexp, yojson]
+
+(** An author object belonging to an embed. *)
+type author = {
+ name: string option;
+ url: string option;
+ icon_url: string option;
+ proxy_icon_url: string option;
+} [@@deriving sexp, yojson]
+
+(** A field object belonging to an embed. *)
+type field = {
+ name: string;
+ value: string;
+ inline: bool;
+} [@@deriving sexp, yojson]
+
+(** An embed object. See this {{:https://leovoel.github.io/embed-visualizer/}embed visualiser} if you need help understanding each component. *)
+type t = {
+ title: string option;
+ kind: string option[@key "type"];
+ description: string option;
+ url: string option;
+ timestamp: string option;
+ colour: int option[@key "color"];
+ footer: footer option;
+ image: image option;
+ thumbnail: image option;
+ video: video option;
+ provider: provider option;
+ author: author option;
+ fields: field list [@default []];
+} [@@deriving sexp, yojson { strict = false }]
+
+(** An embed where all values are empty. *)
+val default : t
+
+(** A footer where all values are empty. *)
+val default_footer : footer
+
+(** An image where all values are empty. *)
+val default_image : image
+
+(** A video where all values are empty. *)
+val default_video : video
+
+(** A provider where all values are empty. *)
+val default_provider : provider
+
+(** An author where all values are empty. *)
+val default_author : author
+
+(** Set the title of an embed. *)
+val title : string -> t -> t
+
+(** Set the description of an embed. *)
+val description : string -> t -> t
+
+(** Set the URL of an embed. *)
+val url : string -> t -> t
+
+(** Set the timestamp of an embed. *)
+val timestamp : string -> t -> t
+
+(** Set the colour of an embed. *)
+val colour : int -> t -> t
+
+(** Identical to {!colour} but with US English spelling. *)
+val color : int -> t -> t
+
+(** Set the footer of an embed. The function passes {!default_footer} and must return a footer. *)
+val footer : (footer -> footer) -> t -> t
+
+(** Set the image URL of an embed. *)
+val image : string -> t -> t
+
+(** Set the thumbnail URL of an embed. *)
+val thumbnail : string -> t -> t
+
+(** Set the author of an embed. The function passes {!default_author} and must return an author. *)
+val author : (author -> author) -> t -> t
+
+(** Add a field to an embed. Takes a tuple in [(name, value, inline)] order. {b Fields added this way will appear in reverse order in the embed.} *)
+val field : string * string * bool -> t -> t
+
+(** Set the fields of an embed. Similar to {!val:field}, but because a complete list is passed, fields preserve order. *)
+val fields : (string * string * bool) list -> t -> t
+
+(** Set the footer text. Typically used in the closure passed to {!val:footer}. *)
+val footer_text : string -> footer -> footer
+
+(** Set the footer icon URL. Typically used in the closure passed to {!val:footer}. *)
+val footer_icon : string -> footer -> footer
+
+(** Set the author name. Typically used in the closure passed to {!val:author}. *)
+val author_name : string -> author -> author
+
+(** Set the author URL. Typically used in the closure passed to {!val:author}. *)
+val author_url : string -> author -> author
+
+(** Set the author icon URL. Typically used in the closure passed to {!val:author}. *)
val author_icon : string -> author -> author
\ No newline at end of file diff --git a/lib/models/channel/message/message.ml b/lib/models/channel/message/message.ml index a64c09d..43929d2 100644 --- a/lib/models/channel/message/message.ml +++ b/lib/models/channel/message/message.ml @@ -1,67 +1,67 @@ -open Async -include Message_t - -let add_reaction msg (emoji:Emoji.t) = - let `Message_id id = msg.id in - let `Channel_id channel_id = msg.channel_id in - let e = match emoji.id with - | Some i -> Printf.sprintf "%s:%d" emoji.name i - | None -> emoji.name - in - Http.create_reaction channel_id id e - - -let remove_reaction msg (emoji:Emoji.t) (user:User_t.t) = - let `Message_id id = msg.id in - let `Channel_id channel_id = msg.channel_id in - let `User_id user_id = user.id in - let e = match emoji.id with - | Some i -> Printf.sprintf "%s:%d" emoji.name i - | None -> emoji.name - in - Http.delete_reaction channel_id id e user_id - - -let clear_reactions msg = - let `Message_id id = msg.id in - let `Channel_id channel_id = msg.channel_id in - Http.delete_reactions channel_id id - - -let delete msg = - let `Message_id id = msg.id in - let `Channel_id channel_id = msg.channel_id in - Http.delete_message channel_id id - - -let pin msg = - let `Message_id id = msg.id in - let `Channel_id channel_id = msg.channel_id in - Http.pin_message channel_id id - - -let unpin msg = - let `Message_id id = msg.id in - let `Channel_id channel_id = msg.channel_id in - Http.unpin_message channel_id id - - -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 set_content msg cont = - let `Message_id id = msg.id in - let `Channel_id channel_id = msg.channel_id in - to_yojson { msg with content = cont; } - |> Http.edit_message channel_id id - - -let set_embed msg embed = - let `Message_id id = msg.id in - let `Channel_id channel_id = msg.channel_id in - to_yojson { msg with embeds = [embed]; } - |> Http.edit_message channel_id id +open Async
+include Message_t
+
+let add_reaction msg (emoji:Emoji.t) =
+ let `Message_id id = msg.id in
+ let `Channel_id channel_id = msg.channel_id in
+ let e = match emoji.id with
+ | Some i -> Printf.sprintf "%s:%d" emoji.name i
+ | None -> emoji.name
+ in
+ Http.create_reaction channel_id id e
+
+
+let remove_reaction msg (emoji:Emoji.t) (user:User_t.t) =
+ let `Message_id id = msg.id in
+ let `Channel_id channel_id = msg.channel_id in
+ let `User_id user_id = user.id in
+ let e = match emoji.id with
+ | Some i -> Printf.sprintf "%s:%d" emoji.name i
+ | None -> emoji.name
+ in
+ Http.delete_reaction channel_id id e user_id
+
+
+let clear_reactions msg =
+ let `Message_id id = msg.id in
+ let `Channel_id channel_id = msg.channel_id in
+ Http.delete_reactions channel_id id
+
+
+let delete msg =
+ let `Message_id id = msg.id in
+ let `Channel_id channel_id = msg.channel_id in
+ Http.delete_message channel_id id
+
+
+let pin msg =
+ let `Message_id id = msg.id in
+ let `Channel_id channel_id = msg.channel_id in
+ Http.pin_message channel_id id
+
+
+let unpin msg =
+ let `Message_id id = msg.id in
+ let `Channel_id channel_id = msg.channel_id in
+ Http.unpin_message channel_id id
+
+
+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 set_content msg cont =
+ let `Message_id id = msg.id in
+ let `Channel_id channel_id = msg.channel_id in
+ to_yojson { msg with content = cont; }
+ |> Http.edit_message channel_id id
+
+
+let set_embed msg embed =
+ let `Message_id id = msg.id in
+ let `Channel_id channel_id = msg.channel_id in
+ to_yojson { msg with embeds = [embed]; }
+ |> Http.edit_message channel_id id
\ No newline at end of file diff --git a/lib/models/channel/message/message.mli b/lib/models/channel/message/message.mli index 09e62a4..56e1c98 100644 --- a/lib/models/channel/message/message.mli +++ b/lib/models/channel/message/message.mli @@ -1,20 +1,39 @@ -open Async - -include module type of Message_t - -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 reply_with : - ?embed:Embed.t -> - ?content:string -> - ?file:string -> - ?tts:bool -> - t -> - Message_t.t Deferred.Or_error.t -val set_content : t -> string -> t Deferred.Or_error.t +open Async
+
+include module type of Message_t
+
+(** Add the given emoji as a reaction. *)
+val add_reaction : t -> Emoji.t -> unit Deferred.Or_error.t
+
+(** Remove the reaction. Must also specify the user. *)
+val remove_reaction : t -> Emoji.t -> User_t.t -> unit Deferred.Or_error.t
+
+(** Remove all reactions from the message. *)
+val clear_reactions : t -> unit Deferred.Or_error.t
+
+(** Delete the message. *)
+val delete : t -> unit Deferred.Or_error.t
+
+(** Pin the message. *)
+val pin : t -> unit Deferred.Or_error.t
+
+(** Unping the message. *)
+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]. *)
+val reply_with :
+ ?embed:Embed.t ->
+ ?content:string ->
+ ?file:string ->
+ ?tts:bool ->
+ t ->
+ Message_t.t Deferred.Or_error.t
+
+(** Set the content of the message. *)
+val set_content : t -> string -> t Deferred.Or_error.t
+
+(** Set the embed of the message. *)
val set_embed : t -> Embed.t -> t Deferred.Or_error.t
\ No newline at end of file diff --git a/lib/models/channel/message/message_t.ml b/lib/models/channel/message/message_t.ml index 3c2e736..fc678f6 100644 --- a/lib/models/channel/message/message_t.ml +++ b/lib/models/channel/message/message_t.ml @@ -1,23 +1,23 @@ -open Core - -type t = { - id: Message_id.t; - author: User_t.t; - channel_id: Channel_id_t.t; - member: Member_t.partial_member option [@default None]; - guild_id: Guild_id_t.t option [@default None]; - content: string; - timestamp: string; - edited_timestamp: string option [@default None]; - tts: bool; - mention_everyone: bool; - mentions: User_t.t list [@default []]; - mention_roles: Role_id.t list [@default []]; - attachments: Attachment.t list [@default []]; - embeds: Embed.t list [@default []]; - reactions: Snowflake.t list [@default []]; - nonce: Snowflake.t option [@default None]; - pinned: bool; - webhook_id: Snowflake.t option [@default None]; - kind: int [@key "type"]; +open Core
+
+type t = {
+ id: Message_id.t;
+ author: User_t.t;
+ channel_id: Channel_id_t.t;
+ member: Member_t.partial_member option [@default None];
+ guild_id: Guild_id_t.t option [@default None];
+ content: string;
+ timestamp: string;
+ edited_timestamp: string option [@default None];
+ tts: bool;
+ mention_everyone: bool;
+ mentions: User_t.t list [@default []];
+ mention_roles: Role_id.t list [@default []];
+ attachments: Attachment.t list [@default []];
+ embeds: Embed.t list [@default []];
+ reactions: Snowflake.t list [@default []];
+ nonce: Snowflake.t option [@default None];
+ pinned: bool;
+ webhook_id: Snowflake.t option [@default None];
+ kind: int [@key "type"];
} [@@deriving sexp, yojson { strict = false}]
\ No newline at end of file diff --git a/lib/models/channel/message/message_t.mli b/lib/models/channel/message/message_t.mli index 1f691b5..de56655 100644 --- a/lib/models/channel/message/message_t.mli +++ b/lib/models/channel/message/message_t.mli @@ -1,22 +1,22 @@ -(** Represents a message object. *) -type t = { - id: Message_id.t; - author: User_t.t; - channel_id: Channel_id_t.t; - member: Member_t.partial_member option; - guild_id: Guild_id_t.t option; - content: string; - timestamp: string; - edited_timestamp: string option; - tts: bool; - mention_everyone: bool; - mentions: User_t.t list; - mention_roles: Role_id.t list; - attachments: Attachment.t list; - embeds: Embed.t list; - reactions: Snowflake.t list; - nonce: Snowflake.t option; - pinned: bool; - webhook_id: Snowflake.t option; - kind: int; +(** Represents a message object. *)
+type t = {
+ id: Message_id.t; (** Snowflake ID of the message. *)
+ author: User_t.t; (** User that authored the message. *)
+ channel_id: Channel_id_t.t; (** Channel ID the message exists in. *)
+ member: Member_t.partial_member option; (** A partial member if the message was sent in a guild. *)
+ guild_id: Guild_id_t.t option; (** Guild ID if the message was sent in a guild. *)
+ content: string; (** Content of the message. *)
+ timestamp: string; (** ISO8601 timestamp of when the message was created. *)
+ edited_timestamp: string option; (** Like timestamp, but for last edit, if any. *)
+ tts: bool; (** Whether the message used text-to-speech. *)
+ mention_everyone: bool; (** Whether the message mentioned [@everyone] or [@here] *)
+ mentions: User_t.t list; (** A List of users that were mentioned in the message. *)
+ mention_roles: Role_id.t list; (** A list of roles that were mentioned in the message. *)
+ attachments: Attachment.t list; (** A list of attachments. *)
+ embeds: Embed.t list; (** A List of embeds on the message. *)
+ reactions: Snowflake.t list; (** A list of reactions. *)
+ nonce: Snowflake.t option; (** Used in verification, safe to ignore. *)
+ pinned: bool; (** Whether the message is pinned. *)
+ webhook_id: Snowflake.t option; (** The webhook ID, if the message was sent by a webhook. *)
+ kind: int; (** See {{:https://discordapp.com/developers/docs/resources/channel#message-object-message-types}the discord docs} for message type enumeration. *)
} [@@deriving sexp, yojson]
\ No newline at end of file diff --git a/lib/models/channel/message/reaction_t.ml b/lib/models/channel/message/reaction_t.ml index 1aa3c84..7c78baf 100644 --- a/lib/models/channel/message/reaction_t.ml +++ b/lib/models/channel/message/reaction_t.ml @@ -1,14 +1,14 @@ -open Core - -type reaction_event = { - user_id: User_id_t.t; - channel_id: Channel_id_t.t; - message_id: Message_id.t; - guild_id: Guild_id_t.t option [@default None]; - emoji: Emoji.partial_emoji; -} [@@deriving sexp, yojson] - -type t = { - count: int; - emoji: Emoji.t; +open Core
+
+type reaction_event = {
+ user_id: User_id_t.t;
+ channel_id: Channel_id_t.t;
+ message_id: Message_id.t;
+ guild_id: Guild_id_t.t option [@default None];
+ emoji: Emoji.partial_emoji;
+} [@@deriving sexp, yojson]
+
+type t = {
+ count: int;
+ emoji: Emoji.t;
} [@@deriving sexp, yojson { strict = false}]
\ No newline at end of file diff --git a/lib/models/channel/message/reaction_t.mli b/lib/models/channel/message/reaction_t.mli index 6c2782a..ace8f55 100644 --- a/lib/models/channel/message/reaction_t.mli +++ b/lib/models/channel/message/reaction_t.mli @@ -1,14 +1,14 @@ -(** Represents a single reaction as received over the gateway. *) -type reaction_event = { - user_id: User_id_t.t; - channel_id: Channel_id_t.t; - message_id: Message_id.t; - guild_id: Guild_id_t.t option; - emoji: Emoji.partial_emoji; -} [@@deriving sexp, yojson] - -(** Represents a number of emojis used as a reaction on a message. *) -type t = { - count: int; - emoji: Emoji.t; +(** Represents a single reaction as received over the gateway. *)
+type reaction_event = {
+ user_id: User_id_t.t;
+ channel_id: Channel_id_t.t;
+ message_id: Message_id.t;
+ guild_id: Guild_id_t.t option;
+ emoji: Emoji.partial_emoji;
+} [@@deriving sexp, yojson]
+
+(** Represents a number of emojis used as a reaction on a message. *)
+type t = {
+ count: int;
+ emoji: Emoji.t;
} [@@deriving sexp, yojson]
\ No newline at end of file |