diff options
Diffstat (limited to 'lib/models/user')
| -rw-r--r-- | lib/models/user/activity.ml | 2 | ||||
| -rw-r--r-- | lib/models/user/activity.mli | 2 | ||||
| -rw-r--r-- | lib/models/user/presence.ml | 2 | ||||
| -rw-r--r-- | lib/models/user/presence.mli | 2 | ||||
| -rw-r--r-- | lib/models/user/user.ml | 8 | ||||
| -rw-r--r-- | lib/models/user/user_t.ml | 4 | ||||
| -rw-r--r-- | lib/models/user/user_t.mli | 4 |
7 files changed, 13 insertions, 11 deletions
diff --git a/lib/models/user/activity.ml b/lib/models/user/activity.ml index 293de3b..926c899 100644 --- a/lib/models/user/activity.ml +++ b/lib/models/user/activity.ml @@ -4,4 +4,4 @@ type t = { name: string; kind: int [@key "type"]; url: string option [@default None]; -} [@@deriving sexp, yojson]
\ No newline at end of file +} [@@deriving sexp, yojson { strict = false; exn = true }]
\ No newline at end of file diff --git a/lib/models/user/activity.mli b/lib/models/user/activity.mli index 1ddd4e7..2757f54 100644 --- a/lib/models/user/activity.mli +++ b/lib/models/user/activity.mli @@ -3,4 +3,4 @@ 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 +} [@@deriving sexp, yojson { exn = true }]
\ No newline at end of file diff --git a/lib/models/user/presence.ml b/lib/models/user/presence.ml index 8d5d205..d8683b7 100644 --- a/lib/models/user/presence.ml +++ b/lib/models/user/presence.ml @@ -5,4 +5,4 @@ type t = { game: Activity.t option [@default None]; status: string; activities: Activity.t list; -} [@@deriving sexp, yojson]
\ No newline at end of file +} [@@deriving sexp, yojson { strict = false; exn = true }]
\ No newline at end of file diff --git a/lib/models/user/presence.mli b/lib/models/user/presence.mli index 58a7c25..ae01373 100644 --- a/lib/models/user/presence.mli +++ b/lib/models/user/presence.mli @@ -4,4 +4,4 @@ type t = { game: Activity.t option; (** The current activity of the user, if any. *)
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 +} [@@deriving sexp, yojson { exn = true }]
\ No newline at end of file diff --git a/lib/models/user/user.ml b/lib/models/user/user.ml index 8b14b76..b8c3b25 100644 --- a/lib/models/user/user.ml +++ b/lib/models/user/user.ml @@ -5,17 +5,19 @@ let tag user = Printf.sprintf "%s#%s" user.username user.discriminator
let mention user =
- Printf.sprintf "<@%Ld>" (User_id.get_id user.id)
+ let `User_id id = user.id in
+ Printf.sprintf "<@%d>" id
let default_avatar user =
- let avatar = Int64.(of_string user.discriminator % 5L) in
+ 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 (User_id.get_id user.id) avatar ext
+ 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 8c367fc..b68808d 100644 --- a/lib/models/user/user_t.ml +++ b/lib/models/user/user_t.ml @@ -6,7 +6,7 @@ type partial_user = { discriminator: string option [@default None];
avatar: string option [@default None];
bot: bool [@default false];
-} [@@deriving sexp, yojson]
+} [@@deriving sexp, yojson { strict = false; exn = true }]
type t = {
id: User_id_t.t;
@@ -14,4 +14,4 @@ type t = { discriminator: string;
avatar: string option [@default None];
bot: bool [@default false];
-} [@@deriving sexp, yojson]
\ No newline at end of file +} [@@deriving sexp, yojson { strict = false; exn = true }]
\ No newline at end of file diff --git a/lib/models/user/user_t.mli b/lib/models/user/user_t.mli index e971531..78f7a28 100644 --- a/lib/models/user/user_t.mli +++ b/lib/models/user/user_t.mli @@ -5,7 +5,7 @@ type partial_user = { discriminator: string option;
avatar: string option;
bot: bool;
-} [@@deriving sexp, yojson]
+} [@@deriving sexp, yojson { exn = true }]
(** A user object. *)
type t = {
@@ -14,4 +14,4 @@ type t = { 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 +} [@@deriving sexp, yojson { exn = true }]
\ No newline at end of file |