diff options
| author | Adelyn Breelove <[email protected]> | 2019-01-28 09:48:49 -0700 |
|---|---|---|
| committer | Adelyn Breelove <[email protected]> | 2019-01-28 09:48:49 -0700 |
| commit | f43c41dcf56a30f3fac0de07349b2c505203c380 (patch) | |
| tree | 2d2e228a2dd1cd489927cfec547494a433bded42 /lib/models/user | |
| parent | Fix Message.t.mentions (diff) | |
| download | disml-f43c41dcf56a30f3fac0de07349b2c505203c380.tar.xz disml-f43c41dcf56a30f3fac0de07349b2c505203c380.zip | |
Add more docs
Diffstat (limited to 'lib/models/user')
| -rw-r--r-- | lib/models/user/activity.ml | 2 | ||||
| -rw-r--r-- | lib/models/user/activity.mli | 7 | ||||
| -rw-r--r-- | lib/models/user/presence.mli | 13 | ||||
| -rw-r--r-- | lib/models/user/user.mli | 7 | ||||
| -rw-r--r-- | lib/models/user/user_t.mli | 12 |
5 files changed, 26 insertions, 15 deletions
diff --git a/lib/models/user/activity.ml b/lib/models/user/activity.ml index 8e6ff80..c9b73d8 100644 --- a/lib/models/user/activity.ml +++ b/lib/models/user/activity.ml @@ -3,5 +3,5 @@ open Core type t = { name: string; kind: int [@key "type"]; - url: string [@default ""]; + url: string option [@default None]; } [@@deriving sexp, yojson { strict = false}]
\ No newline at end of file diff --git a/lib/models/user/activity.mli b/lib/models/user/activity.mli index 53173b7..970ac59 100644 --- a/lib/models/user/activity.mli +++ b/lib/models/user/activity.mli @@ -1,5 +1,6 @@ +(** An activity object. *) type t = { - name: string; - kind: int; - url: string; + 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 13c8cf0..6c60d7f 100644 --- a/lib/models/user/presence.mli +++ b/lib/models/user/presence.mli @@ -1,8 +1,9 @@ +(** A user presence. *) type t = { - user: User_t.partial_user; - roles: Role_id.t list; - game: Activity.t option; - guild_id: Guild_id_t.t; - status: string; - activities: Activity.t list; + 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.mli b/lib/models/user/user.mli index 6e2c0f1..d6050c2 100644 --- a/lib/models/user/user.mli +++ b/lib/models/user/user.mli @@ -1,6 +1,13 @@ include module type of User_t +(** The user tag. Equivalent to concatenating the username and discriminator, separated by a '#'. *) val tag : t -> string + +(** The mention string for the user. Equivalent to [<@USER_ID>]. *) val mention : t -> string + +(** The default avatar for the user. *) val default_avatar : t -> string + +(** The avatar url of the user, falling back to the default avatar. *) val face : t -> string
\ No newline at end of file diff --git a/lib/models/user/user_t.mli b/lib/models/user/user_t.mli index b0228f9..694fc1e 100644 --- a/lib/models/user/user_t.mli +++ b/lib/models/user/user_t.mli @@ -1,11 +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; - username: string; - discriminator: string; - avatar: string option; - bot: bool; + 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 |