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/user | |
| parent | Add more docs (diff) | |
| download | disml-8662e92987c437f59d09896a247ec2b5d82c4528.tar.xz disml-8662e92987c437f59d09896a247ec2b5d82c4528.zip | |
Publish docs updates
Diffstat (limited to 'lib/models/user')
| -rw-r--r-- | lib/models/user/activity.mli | 10 | ||||
| -rw-r--r-- | lib/models/user/presence.mli | 16 | ||||
| -rw-r--r-- | lib/models/user/user.ml | 44 | ||||
| -rw-r--r-- | lib/models/user/user_t.ml | 24 | ||||
| -rw-r--r-- | lib/models/user/user_t.mli | 24 |
5 files changed, 59 insertions, 59 deletions
diff --git a/lib/models/user/activity.mli b/lib/models/user/activity.mli index 970ac59..1ddd4e7 100644 --- a/lib/models/user/activity.mli +++ b/lib/models/user/activity.mli @@ -1,6 +1,6 @@ -(** An activity object. *) -type t = { - name: string; (** The name of the activity. *) - kind: int; (** 0 = Playing, 1 = Streaming, 2 = Listening, 3 = Watching *) - url: string option; (** Stream URL. Only validated for kind = 1. *) +(** An activity object. *)
+type t = {
+ name: string; (** The name of the activity. *)
+ kind: int; (** 0 = Playing, 1 = Streaming, 2 = Listening, 3 = Watching *)
+ url: string option; (** Stream URL. Only validated for kind = 1. *)
} [@@deriving sexp, yojson]
\ No newline at end of file diff --git a/lib/models/user/presence.mli b/lib/models/user/presence.mli index 6c60d7f..d75d408 100644 --- a/lib/models/user/presence.mli +++ b/lib/models/user/presence.mli @@ -1,9 +1,9 @@ -(** A user presence. *) -type t = { - user: User_t.partial_user; (** A partial user that this presence belongs to. *) - roles: Role_id.t list; (** A list of roles that the user has. *) - game: Activity.t option; (** The current activity of the user, if any. *) - guild_id: Guild_id_t.t; (** The guild ID in which this presence exists. *) - status: string; (** One of [online], [idle], [offline], or [dnd]. *) - activities: Activity.t list; (** A list of all of the user's current activities. *) +(** A user presence. *)
+type t = {
+ user: User_t.partial_user; (** A partial user that this presence belongs to. *)
+ roles: Role_id.t list; (** A list of roles that the user has. *)
+ game: Activity.t option; (** The current activity of the user, if any. *)
+ guild_id: Guild_id_t.t; (** The guild ID in which this presence exists. *)
+ status: string; (** One of [online], [idle], [offline], or [dnd]. *)
+ activities: Activity.t list; (** A list of all of the user's current activities. *)
} [@@deriving sexp, yojson]
\ No newline at end of file diff --git a/lib/models/user/user.ml b/lib/models/user/user.ml index de7ce01..b8c3b25 100644 --- a/lib/models/user/user.ml +++ b/lib/models/user/user.ml @@ -1,23 +1,23 @@ -open Core -include User_t - -let tag user = - Printf.sprintf "%s#%s" user.username user.discriminator - -let mention user = - let `User_id id = user.id in - Printf.sprintf "<@%d>" id - -let default_avatar user = - let avatar = Int.of_string user.discriminator % 5 in - Endpoints.cdn_default_avatar avatar - -let face user = - let `User_id id = user.id in - match user.avatar with - | Some avatar -> - let ext = if String.is_substring ~substring:"a_" avatar - then "gif" - else "png" in - Endpoints.cdn_avatar id avatar ext +open Core
+include User_t
+
+let tag user =
+ Printf.sprintf "%s#%s" user.username user.discriminator
+
+let mention user =
+ let `User_id id = user.id in
+ Printf.sprintf "<@%d>" id
+
+let default_avatar user =
+ let avatar = Int.of_string user.discriminator % 5 in
+ Endpoints.cdn_default_avatar avatar
+
+let face user =
+ let `User_id id = user.id in
+ match user.avatar with
+ | Some avatar ->
+ let ext = if String.is_substring ~substring:"a_" avatar
+ then "gif"
+ else "png" in
+ Endpoints.cdn_avatar id avatar ext
| None -> default_avatar user
\ No newline at end of file diff --git a/lib/models/user/user_t.ml b/lib/models/user/user_t.ml index 89a6895..8958e84 100644 --- a/lib/models/user/user_t.ml +++ b/lib/models/user/user_t.ml @@ -1,13 +1,13 @@ -open Core - -type partial_user = { - id: User_id_t.t; -} [@@deriving sexp, yojson { strict = false}] - -type t = { - id: User_id_t.t; - username: string; - discriminator: string; - avatar: string option [@default None]; - bot: bool [@default false]; +open Core
+
+type partial_user = {
+ id: User_id_t.t;
+} [@@deriving sexp, yojson { strict = false}]
+
+type t = {
+ id: User_id_t.t;
+ username: string;
+ discriminator: string;
+ avatar: string option [@default None];
+ bot: bool [@default false];
} [@@deriving sexp, yojson { strict = false }]
\ No newline at end of file diff --git a/lib/models/user/user_t.mli b/lib/models/user/user_t.mli index 694fc1e..645df3e 100644 --- a/lib/models/user/user_t.mli +++ b/lib/models/user/user_t.mli @@ -1,13 +1,13 @@ -(** A partial user. Used internally. *) -type partial_user = { - id: User_id_t.t; -} [@@deriving sexp, yojson] - -(** A user object. *) -type t = { - id: User_id_t.t; (** The user's Snowflake ID, wrapped in the convenience [`User_id] type. *) - username: string; (** The username of the user. *) - discriminator: string; (** The 4 digits, as a string, that come after the '#' in a Discord username. *) - avatar: string option; (** The hash of the user avatar, if they have one set. See {!User.face} to get the avatar URL. *) - bot: bool; (** Whether the user is a bot. *) +(** A partial user. Used internally. *)
+type partial_user = {
+ id: User_id_t.t;
+} [@@deriving sexp, yojson]
+
+(** A user object. *)
+type t = {
+ id: User_id_t.t; (** The user's Snowflake ID, wrapped in the convenience [`User_id] type. *)
+ username: string; (** The username of the user. *)
+ discriminator: string; (** The 4 digits, as a string, that come after the '#' in a Discord username. *)
+ avatar: string option; (** The hash of the user avatar, if they have one set. See {!User.face} to get the avatar URL. *)
+ bot: bool; (** Whether the user is a bot. *)
} [@@deriving sexp, yojson]
\ No newline at end of file |