From c090fc8820ce58d6aa778ce71c71a7125cc1460b Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Mon, 9 Sep 2024 20:58:14 -0400 Subject: [PATCH] Always have an online status --- .../main/java/me/braydon/tether/model/DiscordUser.java | 10 +++++++--- JS-SDK/package.json | 2 +- JS-SDK/src/types/user.ts | 8 +------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/API/src/main/java/me/braydon/tether/model/DiscordUser.java b/API/src/main/java/me/braydon/tether/model/DiscordUser.java index af848dc..5303650 100644 --- a/API/src/main/java/me/braydon/tether/model/DiscordUser.java +++ b/API/src/main/java/me/braydon/tether/model/DiscordUser.java @@ -51,9 +51,9 @@ public final class DiscordUser { @NonNull private final String accentColor; /** - * The online status of this user, if known. + * The online status of this user. */ - private final OnlineStatus onlineStatus; + @NonNull private final OnlineStatus onlineStatus; /** * The clients this user is active on, if known. @@ -95,7 +95,11 @@ public final class DiscordUser { Banner banner = profile.getBannerId() == null || profile.getBannerUrl() == null ? null : new Banner(profile.getBannerId(), profile.getBannerUrl()); String accentColor = String.format("#%06X", (0xFFFFFF & profile.getAccentColorRaw())); - OnlineStatus onlineStatus = member == null ? null : member.getOnlineStatus(); + OnlineStatus onlineStatus = member == null ? OnlineStatus.OFFLINE : member.getOnlineStatus(); + if (onlineStatus == OnlineStatus.UNKNOWN) { + onlineStatus = OnlineStatus.OFFLINE; + } + EnumSet activeClients = member == null ? null : member.getActiveClients(); List activities = member == null ? null : member.getActivities(); SpotifyActivity spotify = null; diff --git a/JS-SDK/package.json b/JS-SDK/package.json index f9120a2..1ae6a0d 100644 --- a/JS-SDK/package.json +++ b/JS-SDK/package.json @@ -1,6 +1,6 @@ { "name": "usetether", - "version": "1.1.8", + "version": "1.1.9", "author": "Braydon (Rainnny) ", "description": "An API designed to provide real-time access to a user's Discord data.", "keywords": [ diff --git a/JS-SDK/src/types/user.ts b/JS-SDK/src/types/user.ts index 5d3c8cd..8cd5a73 100644 --- a/JS-SDK/src/types/user.ts +++ b/JS-SDK/src/types/user.ts @@ -37,13 +37,7 @@ export type DiscordUser = { /** * The online status of this user, if known. */ - onlineStatus: - | "ONLINE" - | "IDLE" - | "DO_NOT_DISTURB" - | "OFFLINE" - | "UNKNOWN" - | undefined; + onlineStatus: "ONLINE" | "IDLE" | "DO_NOT_DISTURB" | "OFFLINE"; /** * The clients this user is active on, if known.