Use the new Discord model in the npm lib
This commit is contained in:
parent
3f08400c5f
commit
1df551ade3
@ -22,7 +22,7 @@ public class CustomStatus {
|
||||
@NonNull private final String value;
|
||||
|
||||
/**
|
||||
* The unicode emoji for this status.
|
||||
* The unicode emoji for this status, null if none.
|
||||
*/
|
||||
private final String emoji;
|
||||
|
||||
|
@ -14,12 +14,12 @@ public class DecorationAsset {
|
||||
private static final String DECORATION_URL = "https://cdn.discordapp.com/avatar-decoration-presets/%s.png";
|
||||
|
||||
/**
|
||||
* The id of the clan badge.
|
||||
* The id of this decoration asset.
|
||||
*/
|
||||
@NonNull private final String id;
|
||||
|
||||
/**
|
||||
* The URL of the clan badge.
|
||||
* The URL of this decoration asset.
|
||||
*/
|
||||
@NonNull private final String url;
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Snowflake } from "@/types/snowflake";
|
||||
import { TetherConfig } from "@/types/config";
|
||||
import { DiscordUser } from "@/types/user";
|
||||
import { UserStatusPacket } from "@/types/socket";
|
||||
import { DiscordUser } from "@/types/user/discord-user";
|
||||
|
||||
/**
|
||||
* Connect to the WebSocket and listen
|
||||
|
@ -4,4 +4,4 @@ export * from "@/hook/websocket";
|
||||
// Types
|
||||
export * from "@/types/config";
|
||||
export * from "@/types/snowflake";
|
||||
export * from "@/types/user";
|
||||
export * from "@/types/user/user";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { DiscordUser } from "@/types/user";
|
||||
import { DiscordUser } from "@/types/user/user";
|
||||
|
||||
type SocketPacket = {
|
||||
/**
|
||||
|
@ -1,178 +0,0 @@
|
||||
export type DiscordUser = {
|
||||
/**
|
||||
* The unique snowflake of this user.
|
||||
*/
|
||||
snowflake: number;
|
||||
|
||||
/**
|
||||
* The username of this user.
|
||||
*/
|
||||
username: string;
|
||||
|
||||
/**
|
||||
* The display name of this user, if any.
|
||||
*/
|
||||
displayName: string | undefined;
|
||||
|
||||
/**
|
||||
* The flags of this user.
|
||||
*/
|
||||
flags: UserFlags;
|
||||
|
||||
/**
|
||||
* The avatar of this user.
|
||||
*/
|
||||
avatar: Avatar;
|
||||
|
||||
/**
|
||||
* The banner of this user, if any.
|
||||
*/
|
||||
banner: Banner | undefined;
|
||||
|
||||
/**
|
||||
* The accent color of this user.
|
||||
*/
|
||||
accentColor: string;
|
||||
|
||||
/**
|
||||
* The online status of this user, if known.
|
||||
*/
|
||||
onlineStatus: "ONLINE" | "IDLE" | "DO_NOT_DISTURB" | "OFFLINE";
|
||||
|
||||
/**
|
||||
* The clients this user is active on, if known.
|
||||
*/
|
||||
activeClients: "DESKTOP" | "MOBILE" | "WEB" | undefined;
|
||||
|
||||
/**
|
||||
* The Spotify activity of this user, if known.
|
||||
*/
|
||||
spotify: SpotifyActivity | undefined;
|
||||
|
||||
/**
|
||||
* Is this user a bot?
|
||||
*/
|
||||
bot: boolean;
|
||||
|
||||
/**
|
||||
* The unix time of when this user joined Discord.
|
||||
*/
|
||||
createdAt: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* A user's flags.
|
||||
*/
|
||||
export type UserFlags = {
|
||||
/**
|
||||
* The list of flags the user has.
|
||||
*/
|
||||
list: (
|
||||
| "STAFF"
|
||||
| "PARTNER"
|
||||
| "HYPESQUAD"
|
||||
| "BUG_HUNTER_LEVEL_1"
|
||||
| "HYPESQUAD_BRAVERY"
|
||||
| "HYPESQUAD_BRILLIANCE"
|
||||
| "HYPESQUAD_BALANCE"
|
||||
| "EARLY_SUPPORTER"
|
||||
| "TEAM_USER"
|
||||
| "BUGHUNTER_LEVEL_2"
|
||||
| "VERIFIED_BOT"
|
||||
| "VERIFIED_DEVELOPER"
|
||||
| "CERTIFIED_MODERATOR"
|
||||
| "BOT_HTTP_INTERACTIONS"
|
||||
| "ACTIVE_DEVELOPER"
|
||||
| "UNKNOWN"
|
||||
)[];
|
||||
|
||||
/**
|
||||
* The raw flags the user has.
|
||||
*/
|
||||
raw: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* A user's avatar.
|
||||
*/
|
||||
export type Avatar = {
|
||||
/**
|
||||
* The id of the user's avatar.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The URL of the user's avatar.
|
||||
*/
|
||||
url: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* A user's banner.
|
||||
*/
|
||||
export type Banner = {
|
||||
/**
|
||||
* The id of the user's avatar.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The URL of the user's avatar.
|
||||
*/
|
||||
url: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* A user's Spotify activity data.
|
||||
*/
|
||||
export type SpotifyActivity = {
|
||||
/**
|
||||
* The ID of the currently playing track.
|
||||
*/
|
||||
trackId: string;
|
||||
|
||||
/**
|
||||
* The name of the currently playing track.
|
||||
*/
|
||||
song: string;
|
||||
|
||||
/**
|
||||
* The currently playing artist.
|
||||
*/
|
||||
artist: string;
|
||||
|
||||
/**
|
||||
* The album the song is from.
|
||||
*/
|
||||
album: string;
|
||||
|
||||
/**
|
||||
* The URL to the art for the currently playing album.
|
||||
*/
|
||||
albumArtUrl: string;
|
||||
|
||||
/**
|
||||
* The URL to the playing track.
|
||||
*/
|
||||
trackUrl: string;
|
||||
|
||||
/**
|
||||
* The current progress of the track (in millis).
|
||||
*/
|
||||
trackProgress: number;
|
||||
|
||||
/**
|
||||
* The total length of the track (in millis).
|
||||
*/
|
||||
trackLength: number;
|
||||
|
||||
/**
|
||||
* The unix time of when this track started playing.
|
||||
*/
|
||||
started: number;
|
||||
|
||||
/**
|
||||
* The unix time of when this track stops playing.
|
||||
*/
|
||||
ends: number;
|
||||
};
|
21
use-tether/src/types/user/avatar/avatar-decoration.ts
Normal file
21
use-tether/src/types/user/avatar/avatar-decoration.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { DecorationAsset } from "@/types/user/avatar/decoration-asset";
|
||||
|
||||
/**
|
||||
* The decoration for a {@link Avatar}.
|
||||
*/
|
||||
export type AvatarDecoration = {
|
||||
/**
|
||||
* The asset of this decoration.
|
||||
*/
|
||||
asset: DecorationAsset;
|
||||
|
||||
/**
|
||||
* The id of the decoration sku.
|
||||
*/
|
||||
skuId: string;
|
||||
|
||||
/**
|
||||
* The unix time of when this decorations expires, undefined if permanent.
|
||||
*/
|
||||
expires: number | undefined;
|
||||
};
|
14
use-tether/src/types/user/avatar/avatar.ts
Normal file
14
use-tether/src/types/user/avatar/avatar.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* An avatar for a {@link DiscordUser}.
|
||||
*/
|
||||
export type Avatar = {
|
||||
/**
|
||||
* The id of the user's avatar.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The URL of the user's avatar.
|
||||
*/
|
||||
url: string;
|
||||
};
|
14
use-tether/src/types/user/avatar/decoration-asset.ts
Normal file
14
use-tether/src/types/user/avatar/decoration-asset.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* The decoration asset for a {@link AvatarDecoration}.
|
||||
*/
|
||||
export type DecorationAsset = {
|
||||
/**
|
||||
* The id of this decoration asset.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The URL of this decoration asset.
|
||||
*/
|
||||
url: string;
|
||||
};
|
14
use-tether/src/types/user/badge/user-badge-icon.ts
Normal file
14
use-tether/src/types/user/badge/user-badge-icon.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* The icon of a {@link UserBadge}.
|
||||
*/
|
||||
export type UserBadgeIcon = {
|
||||
/**
|
||||
* The id of the user's badge.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The URL of the user's badge.
|
||||
*/
|
||||
url: string;
|
||||
};
|
26
use-tether/src/types/user/badge/user-badge.ts
Normal file
26
use-tether/src/types/user/badge/user-badge.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { UserBadgeIcon } from "@/types/user/badge/user-badge-icon";
|
||||
|
||||
/**
|
||||
* The badge of a {@link DiscordUser}.
|
||||
*/
|
||||
export type UserBadge = {
|
||||
/**
|
||||
* The id of this user badge.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The description of this user badge.
|
||||
*/
|
||||
description: string;
|
||||
|
||||
/**
|
||||
* The icon of this user badge.
|
||||
*/
|
||||
icon: UserBadgeIcon;
|
||||
|
||||
/**
|
||||
* The link to this user badge, if any.
|
||||
*/
|
||||
link: string | undefined;
|
||||
};
|
14
use-tether/src/types/user/banner.ts
Normal file
14
use-tether/src/types/user/banner.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* A banner for a {@link DiscordUser}.
|
||||
*/
|
||||
export type Banner = {
|
||||
/**
|
||||
* The id of the user's avatar.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The URL of the user's avatar.
|
||||
*/
|
||||
url: string;
|
||||
};
|
14
use-tether/src/types/user/clan/clan-badge.ts
Normal file
14
use-tether/src/types/user/clan/clan-badge.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* The badge of a {@link Clan}.
|
||||
*/
|
||||
export type ClanBadge = {
|
||||
/**
|
||||
* The id of the clan badge.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The URL of the clan badge.
|
||||
*/
|
||||
url: string;
|
||||
};
|
26
use-tether/src/types/user/clan/clan.ts
Normal file
26
use-tether/src/types/user/clan/clan.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { ClanBadge } from "@/types/user/clan/clan-badge";
|
||||
|
||||
/**
|
||||
* A clan a {@link DiscordUser} is in.
|
||||
*/
|
||||
export type Clan = {
|
||||
/**
|
||||
* The snowflake of the Guild this clan belongs to.
|
||||
*/
|
||||
guildSnowflake: number;
|
||||
|
||||
/**
|
||||
* The tag of this clan.
|
||||
*/
|
||||
tag: string;
|
||||
|
||||
/**
|
||||
* The badge for this clan.
|
||||
*/
|
||||
clanBadge: ClanBadge;
|
||||
|
||||
/**
|
||||
* Whether the identity is enabled for this clan.
|
||||
*/
|
||||
identityEnabled: boolean;
|
||||
};
|
31
use-tether/src/types/user/connected-account.ts
Normal file
31
use-tether/src/types/user/connected-account.ts
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* A connected account of a {@link DiscordUser}.
|
||||
*/
|
||||
export type ConnectedAccount = {
|
||||
/**
|
||||
* The id of this account.
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The type of this account.
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/**
|
||||
* The name of this account.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The metadata for this account.
|
||||
*/
|
||||
metadata: {
|
||||
[key: string]: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Whether this account is verified.
|
||||
*/
|
||||
verified: boolean;
|
||||
};
|
14
use-tether/src/types/user/custom-status.ts
Normal file
14
use-tether/src/types/user/custom-status.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* The custom status of a {@link DiscordUser}.
|
||||
*/
|
||||
export type CustomStatus = {
|
||||
/**
|
||||
* The value of this status.
|
||||
*/
|
||||
value: string;
|
||||
|
||||
/**
|
||||
* The unicode emoji for this status, undefined if none.
|
||||
*/
|
||||
emoji: string | undefined;
|
||||
};
|
127
use-tether/src/types/user/discord-user.ts
Normal file
127
use-tether/src/types/user/discord-user.ts
Normal file
@ -0,0 +1,127 @@
|
||||
import { UserFlags } from "@/types/user/user-flags";
|
||||
import { Avatar } from "@/types/user/avatar/avatar";
|
||||
import { Banner } from "@/types/user/banner";
|
||||
import { AvatarDecoration } from "@/types/user/avatar/avatar-decoration";
|
||||
import { CustomStatus } from "@/types/user/custom-status";
|
||||
import { SpotifyActivity } from "@/types/user/spotify-activity";
|
||||
import { UserBadge } from "@/types/user/badge/user-badge";
|
||||
import { ConnectedAccount } from "@/types/user/connected-account";
|
||||
import { Clan } from "@/types/user/clan/clan";
|
||||
import { NitroSubscription } from "@/types/user/nitro-subscription";
|
||||
|
||||
export type DiscordUser = {
|
||||
/**
|
||||
* The unique snowflake of this user.
|
||||
*/
|
||||
snowflake: number;
|
||||
|
||||
/**
|
||||
* The username of this user.
|
||||
*/
|
||||
username: string;
|
||||
|
||||
/**
|
||||
* This user's legacy username, if any.
|
||||
*/
|
||||
legacyUsername: string | undefined;
|
||||
|
||||
/**
|
||||
* The display name of this user, if any.
|
||||
*/
|
||||
displayName: string | undefined;
|
||||
|
||||
/**
|
||||
* The user's discriminator, 0 if not legacy.
|
||||
*/
|
||||
discriminator: number;
|
||||
|
||||
/**
|
||||
* The flags of this user.
|
||||
*/
|
||||
flags: UserFlags;
|
||||
|
||||
/**
|
||||
* The avatar of this user.
|
||||
*/
|
||||
avatar: Avatar;
|
||||
|
||||
/**
|
||||
* The avatar decoration of this user, if any.
|
||||
*/
|
||||
avatarDecoration: AvatarDecoration | undefined;
|
||||
|
||||
/**
|
||||
* The banner of this user, if any.
|
||||
*/
|
||||
banner: Banner | undefined;
|
||||
|
||||
/**
|
||||
* The banner color (hex) of this user, if any.
|
||||
*/
|
||||
bannerColor: string | undefined;
|
||||
|
||||
/**
|
||||
* The custom status of this user, if any.
|
||||
*/
|
||||
customStatus: CustomStatus | undefined;
|
||||
|
||||
/**
|
||||
* The user's bio, if any.
|
||||
*/
|
||||
bio: string | undefined;
|
||||
|
||||
/**
|
||||
* The user's pronouns, if any.
|
||||
*/
|
||||
pronouns: string | undefined;
|
||||
|
||||
/**
|
||||
* The accent color of this user.
|
||||
*/
|
||||
accentColor: string;
|
||||
|
||||
/**
|
||||
* The online status of this user, if known.
|
||||
*/
|
||||
onlineStatus: "ONLINE" | "IDLE" | "DO_NOT_DISTURB" | "OFFLINE";
|
||||
|
||||
/**
|
||||
* The clients this user is active on, if known.
|
||||
*/
|
||||
activeClients: "DESKTOP" | "MOBILE" | "WEB" | undefined;
|
||||
|
||||
/**
|
||||
* The Spotify activity of this user, if known.
|
||||
*/
|
||||
spotify: SpotifyActivity | undefined;
|
||||
|
||||
/**
|
||||
* The badges this user has.
|
||||
*/
|
||||
badges: UserBadge[];
|
||||
|
||||
/**
|
||||
* The connected accounts of this user.
|
||||
*/
|
||||
connectedAccounts: ConnectedAccount[];
|
||||
|
||||
/**
|
||||
* The clan this user is in, if any.
|
||||
*/
|
||||
clan: Clan | undefined;
|
||||
|
||||
/**
|
||||
* This user's Nitro subscription, if any.
|
||||
*/
|
||||
nitroSubscription: NitroSubscription | undefined;
|
||||
|
||||
/**
|
||||
* Is this user a bot?
|
||||
*/
|
||||
bot: boolean;
|
||||
|
||||
/**
|
||||
* The unix time of when this user joined Discord.
|
||||
*/
|
||||
createdAt: number;
|
||||
};
|
14
use-tether/src/types/user/nitro-subscription.ts
Normal file
14
use-tether/src/types/user/nitro-subscription.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* A Nitro subscription for a {@link DiscordUser}.
|
||||
*/
|
||||
export type NitroSubscription = {
|
||||
/**
|
||||
* The type of this subscription.
|
||||
*/
|
||||
type: "CLASSIC" | "NITRO" | "BASIC" | "UNKNOWN";
|
||||
|
||||
/**
|
||||
* The unix time this subscription was started.
|
||||
*/
|
||||
subscribed: number;
|
||||
};
|
54
use-tether/src/types/user/spotify-activity.ts
Normal file
54
use-tether/src/types/user/spotify-activity.ts
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* The Spotify activity for a {@link DiscordUser}.
|
||||
*/
|
||||
export type SpotifyActivity = {
|
||||
/**
|
||||
* The ID of the currently playing track.
|
||||
*/
|
||||
trackId: string;
|
||||
|
||||
/**
|
||||
* The name of the currently playing track.
|
||||
*/
|
||||
song: string;
|
||||
|
||||
/**
|
||||
* The currently playing artist.
|
||||
*/
|
||||
artist: string;
|
||||
|
||||
/**
|
||||
* The album the song is from.
|
||||
*/
|
||||
album: string;
|
||||
|
||||
/**
|
||||
* The URL to the art for the currently playing album.
|
||||
*/
|
||||
albumArtUrl: string;
|
||||
|
||||
/**
|
||||
* The URL to the playing track.
|
||||
*/
|
||||
trackUrl: string;
|
||||
|
||||
/**
|
||||
* The current progress of the track (in millis).
|
||||
*/
|
||||
trackProgress: number;
|
||||
|
||||
/**
|
||||
* The total length of the track (in millis).
|
||||
*/
|
||||
trackLength: number;
|
||||
|
||||
/**
|
||||
* The unix time of when this track started playing.
|
||||
*/
|
||||
started: number;
|
||||
|
||||
/**
|
||||
* The unix time of when this track stops playing.
|
||||
*/
|
||||
ends: number;
|
||||
};
|
31
use-tether/src/types/user/user-flags.ts
Normal file
31
use-tether/src/types/user/user-flags.ts
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* The flags of a {@link DiscordUser}.
|
||||
*/
|
||||
export type UserFlags = {
|
||||
/**
|
||||
* The list of flags the user has.
|
||||
*/
|
||||
list: (
|
||||
| "STAFF"
|
||||
| "PARTNER"
|
||||
| "HYPESQUAD"
|
||||
| "BUG_HUNTER_LEVEL_1"
|
||||
| "HYPESQUAD_BRAVERY"
|
||||
| "HYPESQUAD_BRILLIANCE"
|
||||
| "HYPESQUAD_BALANCE"
|
||||
| "EARLY_SUPPORTER"
|
||||
| "TEAM_USER"
|
||||
| "BUGHUNTER_LEVEL_2"
|
||||
| "VERIFIED_BOT"
|
||||
| "VERIFIED_DEVELOPER"
|
||||
| "CERTIFIED_MODERATOR"
|
||||
| "BOT_HTTP_INTERACTIONS"
|
||||
| "ACTIVE_DEVELOPER"
|
||||
| "UNKNOWN"
|
||||
)[];
|
||||
|
||||
/**
|
||||
* The raw flags the user has.
|
||||
*/
|
||||
raw: number;
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user