aboutsummaryrefslogtreecommitdiff
path: root/lib/models/channel
diff options
context:
space:
mode:
authorAdelyn Breedlove <[email protected]>2019-01-28 10:31:51 -0700
committerAdelyn Breedlove <[email protected]>2019-01-28 10:31:51 -0700
commit8662e92987c437f59d09896a247ec2b5d82c4528 (patch)
treef004cc14598351d4ad6b19d8e993d2f629c5e738 /lib/models/channel
parentAdd more docs (diff)
downloaddisml-8662e92987c437f59d09896a247ec2b5d82c4528.tar.xz
disml-8662e92987c437f59d09896a247ec2b5d82c4528.zip
Publish docs updates
Diffstat (limited to 'lib/models/channel')
-rw-r--r--lib/models/channel/channel.ml4
-rw-r--r--lib/models/channel/channel.mli4
-rw-r--r--lib/models/channel/channel_t.ml234
-rw-r--r--lib/models/channel/channel_t.mli190
-rw-r--r--lib/models/channel/message/attachment.mli16
-rw-r--r--lib/models/channel/message/embed.ml240
-rw-r--r--lib/models/channel/message/embed.mli254
-rw-r--r--lib/models/channel/message/message.ml132
-rw-r--r--lib/models/channel/message/message.mli57
-rw-r--r--lib/models/channel/message/message_t.ml44
-rw-r--r--lib/models/channel/message/message_t.mli42
-rw-r--r--lib/models/channel/message/reaction_t.ml26
-rw-r--r--lib/models/channel/message/reaction_t.mli26
13 files changed, 644 insertions, 625 deletions
diff --git a/lib/models/channel/channel.ml b/lib/models/channel/channel.ml
index 68b3a97..6ccc66d 100644
--- a/lib/models/channel/channel.ml
+++ b/lib/models/channel/channel.ml
@@ -1,3 +1,3 @@
-include Channel_t
-
+include Channel_t
+
include Impl.Channel(Channel_t) \ No newline at end of file
diff --git a/lib/models/channel/channel.mli b/lib/models/channel/channel.mli
index feb7323..3eece7d 100644
--- a/lib/models/channel/channel.mli
+++ b/lib/models/channel/channel.mli
@@ -1,3 +1,3 @@
-include module type of Channel_t
-include S.ChannelImpl with
+include module type of Channel_t
+include S.ChannelImpl with
type t := Channel_t.t \ No newline at end of file
diff --git a/lib/models/channel/channel_t.ml b/lib/models/channel/channel_t.ml
index 62d6ac0..b02fa31 100644
--- a/lib/models/channel/channel_t.ml
+++ b/lib/models/channel/channel_t.ml
@@ -1,118 +1,118 @@
-open Core
-
-exception Invalid_channel of Yojson.Safe.json
-
-type group = {
- id: Channel_id_t.t;
- last_message_id: Message_id.t option [@default None];
- last_pin_timestamp: string option [@default None];
- icon: string option [@default None];
- name: string option [@default None];
- owner_id: User_id_t.t;
- recipients: User_t.t list [@default []];
-} [@@deriving sexp, yojson { strict = false}]
-
-type dm = {
- id: Channel_id_t.t;
- last_message_id: Message_id.t option [@default None];
- last_pin_timestamp: string option [@default None];
-} [@@deriving sexp, yojson { strict = false}]
-
-type guild_text = {
- id: Channel_id_t.t;
- last_message_id: Message_id.t option [@default None];
- last_pin_timestamp: string option [@default None];
- category_id: Channel_id_t.t option [@default None][@key "parent_id"];
- guild_id: Guild_id_t.t option [@default None];
- name: string;
- position: int;
- topic: string option [@default None];
- nsfw: bool;
- slow_mode_timeout: int option [@default None];
-} [@@deriving sexp, yojson { strict = false}]
-
-type guild_voice = {
- id: Channel_id_t.t;
- category_id: Channel_id_t.t option [@default None][@key "parent_id"];
- guild_id: Guild_id_t.t option [@default None];
- name: string;
- position: int;
- user_limit: int [@default -1];
- bitrate: int option [@default None];
-} [@@deriving sexp, yojson { strict = false}]
-
-type category = {
- id: Channel_id_t.t;
- guild_id: Guild_id_t.t option [@default None];
- position: int;
- name: string;
-} [@@deriving sexp, yojson { strict = false}]
-
-type t =
-| Group of group
-| Private of dm
-| GuildText of guild_text
-| GuildVoice of guild_voice
-| Category of category
-[@@deriving sexp, yojson { strict = false}]
-
-type channel_wrapper = {
- id: Channel_id_t.t;
- kind: int [@key "type"];
- guild_id: Guild_id_t.t option [@default None];
- position: int option [@default None];
- name: string option [@default None];
- topic: string option [@default None];
- nsfw: bool option [@default None];
- last_message_id: Message_id.t option [@default None];
- bitrate: int option [@default None];
- user_limit: int option [@default None];
- slow_mode_timeout: int option [@default None];
- recipients: User_t.t list option [@default None];
- icon: string option [@default None];
- owner_id: User_id_t.t option [@default None];
- application_id: Snowflake.t option [@default None];
- category_id: Channel_id_t.t option [@default None][@key "parent_id"];
- last_pin_timestamp: string option [@default None];
-} [@@deriving sexp, yojson { strict = false}]
-
-let unwrap_as_guild_text {id;guild_id;position;name;topic;nsfw;last_message_id;slow_mode_timeout;category_id;last_pin_timestamp;_} =
- let position = Option.value_exn position in
- let name = Option.value_exn name in
- let nsfw = Option.value ~default:false nsfw in
- { id; guild_id; position; name; topic; nsfw; last_message_id; slow_mode_timeout; category_id; last_pin_timestamp }
-
-let unwrap_as_guild_voice {id;guild_id;position;name;bitrate;user_limit;category_id;_} =
- let position = Option.value_exn position in
- let name = Option.value_exn name in
- let user_limit = Option.value ~default:(-1) user_limit in
- { id; guild_id; position; name; user_limit; bitrate ; category_id; }
-
-let unwrap_as_dm {id;last_message_id;last_pin_timestamp;_} =
- { id; last_message_id; last_pin_timestamp; }
-
-let unwrap_as_group {id;name;last_message_id;recipients;icon;owner_id;last_pin_timestamp;_} =
- let recipients = Option.value ~default:[] recipients in
- let owner_id = Option.value_exn owner_id in
- { id; name; last_message_id; recipients; icon; owner_id; last_pin_timestamp; }
-
-let unwrap_as_category {id;guild_id;position;name;_} =
- let position = Option.value_exn position in
- let name = Option.value_exn name in
- { id; guild_id; position; name; }
-
-let wrap s =
- match s.kind with
- | 0 -> GuildText (unwrap_as_guild_text s)
- | 1 -> Private (unwrap_as_dm s)
- | 2 -> GuildVoice (unwrap_as_guild_voice s)
- | 3 -> Group (unwrap_as_group s)
- | 4 -> Category (unwrap_as_category s)
- | _ -> raise (Invalid_channel (channel_wrapper_to_yojson s))
-
-let get_id = function
-| Group g -> let `Channel_id id = g.id in id
-| Private p -> let `Channel_id id = p.id in id
-| GuildText t -> let `Channel_id id = t.id in id
-| GuildVoice v -> let `Channel_id id = v.id in id
+open Core
+
+exception Invalid_channel of Yojson.Safe.json
+
+type group = {
+ id: Channel_id_t.t;
+ last_message_id: Message_id.t option [@default None];
+ last_pin_timestamp: string option [@default None];
+ icon: string option [@default None];
+ name: string option [@default None];
+ owner_id: User_id_t.t;
+ recipients: User_t.t list [@default []];
+} [@@deriving sexp, yojson { strict = false}]
+
+type dm = {
+ id: Channel_id_t.t;
+ last_message_id: Message_id.t option [@default None];
+ last_pin_timestamp: string option [@default None];
+} [@@deriving sexp, yojson { strict = false}]
+
+type guild_text = {
+ id: Channel_id_t.t;
+ last_message_id: Message_id.t option [@default None];
+ last_pin_timestamp: string option [@default None];
+ category_id: Channel_id_t.t option [@default None][@key "parent_id"];
+ guild_id: Guild_id_t.t option [@default None];
+ name: string;
+ position: int;
+ topic: string option [@default None];
+ nsfw: bool;
+ slow_mode_timeout: int option [@default None];
+} [@@deriving sexp, yojson { strict = false}]
+
+type guild_voice = {
+ id: Channel_id_t.t;
+ category_id: Channel_id_t.t option [@default None][@key "parent_id"];
+ guild_id: Guild_id_t.t option [@default None];
+ name: string;
+ position: int;
+ user_limit: int [@default -1];
+ bitrate: int option [@default None];
+} [@@deriving sexp, yojson { strict = false}]
+
+type category = {
+ id: Channel_id_t.t;
+ guild_id: Guild_id_t.t option [@default None];
+ position: int;
+ name: string;
+} [@@deriving sexp, yojson { strict = false}]
+
+type t =
+| Group of group
+| Private of dm
+| GuildText of guild_text
+| GuildVoice of guild_voice
+| Category of category
+[@@deriving sexp, yojson { strict = false}]
+
+type channel_wrapper = {
+ id: Channel_id_t.t;
+ kind: int [@key "type"];
+ guild_id: Guild_id_t.t option [@default None];
+ position: int option [@default None];
+ name: string option [@default None];
+ topic: string option [@default None];
+ nsfw: bool option [@default None];
+ last_message_id: Message_id.t option [@default None];
+ bitrate: int option [@default None];
+ user_limit: int option [@default None];
+ slow_mode_timeout: int option [@default None];
+ recipients: User_t.t list option [@default None];
+ icon: string option [@default None];
+ owner_id: User_id_t.t option [@default None];
+ application_id: Snowflake.t option [@default None];
+ category_id: Channel_id_t.t option [@default None][@key "parent_id"];
+ last_pin_timestamp: string option [@default None];
+} [@@deriving sexp, yojson { strict = false}]
+
+let unwrap_as_guild_text {id;guild_id;position;name;topic;nsfw;last_message_id;slow_mode_timeout;category_id;last_pin_timestamp;_} =
+ let position = Option.value_exn position in
+ let name = Option.value_exn name in
+ let nsfw = Option.value ~default:false nsfw in
+ { id; guild_id; position; name; topic; nsfw; last_message_id; slow_mode_timeout; category_id; last_pin_timestamp }
+
+let unwrap_as_guild_voice {id;guild_id;position;name;bitrate;user_limit;category_id;_} =
+ let position = Option.value_exn position in
+ let name = Option.value_exn name in
+ let user_limit = Option.value ~default:(-1) user_limit in
+ { id; guild_id; position; name; user_limit; bitrate ; category_id; }
+
+let unwrap_as_dm {id;last_message_id;last_pin_timestamp;_} =
+ { id; last_message_id; last_pin_timestamp; }
+
+let unwrap_as_group {id;name;last_message_id;recipients;icon;owner_id;last_pin_timestamp;_} =
+ let recipients = Option.value ~default:[] recipients in
+ let owner_id = Option.value_exn owner_id in
+ { id; name; last_message_id; recipients; icon; owner_id; last_pin_timestamp; }
+
+let unwrap_as_category {id;guild_id;position;name;_} =
+ let position = Option.value_exn position in
+ let name = Option.value_exn name in
+ { id; guild_id; position; name; }
+
+let wrap s =
+ match s.kind with
+ | 0 -> GuildText (unwrap_as_guild_text s)
+ | 1 -> Private (unwrap_as_dm s)
+ | 2 -> GuildVoice (unwrap_as_guild_voice s)
+ | 3 -> Group (unwrap_as_group s)
+ | 4 -> Category (unwrap_as_category s)
+ | _ -> raise (Invalid_channel (channel_wrapper_to_yojson s))
+
+let get_id = function
+| Group g -> let `Channel_id id = g.id in id
+| Private p -> let `Channel_id id = p.id in id
+| GuildText t -> let `Channel_id id = t.id in id
+| GuildVoice v -> let `Channel_id id = v.id in id
| Category c -> let `Channel_id id = c.id in id \ No newline at end of file
diff --git a/lib/models/channel/channel_t.mli b/lib/models/channel/channel_t.mli
index 9deea82..711b319 100644
--- a/lib/models/channel/channel_t.mli
+++ b/lib/models/channel/channel_t.mli
@@ -1,96 +1,96 @@
-exception Invalid_channel of Yojson.Safe.json
-
-(** Represents a Group channel object. *)
-type group = {
- id: Channel_id_t.t;
- last_message_id: Message_id.t option;
- last_pin_timestamp: string option;
- icon: string option;
- name: string option;
- owner_id: User_id_t.t;
- recipients: User_t.t list;
-} [@@deriving sexp, yojson]
-
-(** Represents a private channel with a single user. *)
-type dm = {
- id: Channel_id_t.t;
- last_message_id: Message_id.t option;
- last_pin_timestamp: string option;
-} [@@deriving sexp, yojson]
-
-(** Represents a text channel in a guild. *)
-type guild_text = {
- id: Channel_id_t.t;
- last_message_id: Message_id.t option;
- last_pin_timestamp: string option;
- category_id: Channel_id_t.t option;
- guild_id: Guild_id_t.t option;
- name: string;
- position: int;
- topic: string option;
- nsfw: bool;
- slow_mode_timeout: int option;
-} [@@deriving sexp, yojson]
-
-(** Represents a voice channel in a guild. *)
-type guild_voice = {
- id: Channel_id_t.t;
- category_id: Channel_id_t.t option;
- guild_id: Guild_id_t.t option;
- name: string;
- position: int;
- user_limit: int;
- bitrate: int option;
-} [@@deriving sexp, yojson]
-
-(** Represents a guild category. *)
-type category = {
- id: Channel_id_t.t;
- guild_id: Guild_id_t.t option;
- position: int;
- name: string;
-} [@@deriving sexp, yojson]
-
-(** Wrapper variant for all channel types. *)
-type t =
-| Group of group
-| Private of dm
-| GuildText of guild_text
-| GuildVoice of guild_voice
-| Category of category
-[@@deriving sexp, yojson]
-
-(** Intermediate used internally. *)
-type channel_wrapper = {
- id: Channel_id_t.t;
- kind: int;
- guild_id: Guild_id_t.t option;
- position: int option;
- name: string option;
- topic: string option;
- nsfw: bool option;
- last_message_id: Message_id.t option;
- bitrate: int option;
- user_limit: int option;
- slow_mode_timeout: int option;
- recipients: User_t.t list option;
- icon: string option;
- owner_id: User_id_t.t option;
- application_id: Snowflake.t option;
- category_id: Channel_id_t.t option;
- last_pin_timestamp: string option;
-} [@@deriving sexp, yojson]
-
-val unwrap_as_guild_text : channel_wrapper -> guild_text
-
-val unwrap_as_guild_voice : channel_wrapper -> guild_voice
-
-val unwrap_as_dm : channel_wrapper -> dm
-
-val unwrap_as_group : channel_wrapper -> group
-
-val unwrap_as_category : channel_wrapper -> category
-
-val wrap : channel_wrapper -> t
-
+exception Invalid_channel of Yojson.Safe.json
+
+(** Represents a Group channel object. *)
+type group = {
+ id: Channel_id_t.t;
+ last_message_id: Message_id.t option;
+ last_pin_timestamp: string option;
+ icon: string option;
+ name: string option;
+ owner_id: User_id_t.t;
+ recipients: User_t.t list;
+} [@@deriving sexp, yojson]
+
+(** Represents a private channel with a single user. *)
+type dm = {
+ id: Channel_id_t.t;
+ last_message_id: Message_id.t option;
+ last_pin_timestamp: string option;
+} [@@deriving sexp, yojson]
+
+(** Represents a text channel in a guild. *)
+type guild_text = {
+ id: Channel_id_t.t;
+ last_message_id: Message_id.t option;
+ last_pin_timestamp: string option;
+ category_id: Channel_id_t.t option;
+ guild_id: Guild_id_t.t option;
+ name: string;
+ position: int;
+ topic: string option;
+ nsfw: bool;
+ slow_mode_timeout: int option;
+} [@@deriving sexp, yojson]
+
+(** Represents a voice channel in a guild. *)
+type guild_voice = {
+ id: Channel_id_t.t;
+ category_id: Channel_id_t.t option;
+ guild_id: Guild_id_t.t option;
+ name: string;
+ position: int;
+ user_limit: int;
+ bitrate: int option;
+} [@@deriving sexp, yojson]
+
+(** Represents a guild category. *)
+type category = {
+ id: Channel_id_t.t;
+ guild_id: Guild_id_t.t option;
+ position: int;
+ name: string;
+} [@@deriving sexp, yojson]
+
+(** Wrapper variant for all channel types. *)
+type t =
+| Group of group
+| Private of dm
+| GuildText of guild_text
+| GuildVoice of guild_voice
+| Category of category
+[@@deriving sexp, yojson]
+
+(** Intermediate used internally. *)
+type channel_wrapper = {
+ id: Channel_id_t.t;
+ kind: int;
+ guild_id: Guild_id_t.t option;
+ position: int option;
+ name: string option;
+ topic: string option;
+ nsfw: bool option;
+ last_message_id: Message_id.t option;
+ bitrate: int option;
+ user_limit: int option;
+ slow_mode_timeout: int option;
+ recipients: User_t.t list option;
+ icon: string option;
+ owner_id: User_id_t.t option;
+ application_id: Snowflake.t option;
+ category_id: Channel_id_t.t option;
+ last_pin_timestamp: string option;
+} [@@deriving sexp, yojson]
+
+val unwrap_as_guild_text : channel_wrapper -> guild_text
+
+val unwrap_as_guild_voice : channel_wrapper -> guild_voice
+
+val unwrap_as_dm : channel_wrapper -> dm
+
+val unwrap_as_group : channel_wrapper -> group
+
+val unwrap_as_category : channel_wrapper -> category
+
+val wrap : channel_wrapper -> t
+
val get_id : t -> Snowflake.t \ No newline at end of file
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