mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 17:00:08 +00:00
types: add user types (#700)
* types: add user types * Add CreateGroupDM
This commit is contained in:
26
src/types/users/connection.ts
Normal file
26
src/types/users/connection.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { SnakeCaseProps } from "../util.ts";
|
||||
import { DiscordVisibilityTypes } from "./visibility_types.ts";
|
||||
|
||||
export interface Connection {
|
||||
/** id of the connection account */
|
||||
id: string;
|
||||
/** The username of the connection account */
|
||||
name: string;
|
||||
/** The service of the connection (twitch, youtube) */
|
||||
type: string;
|
||||
/** Whether the connection is revoked */
|
||||
revoked?: boolean;
|
||||
/** An array of partial server integrations */
|
||||
integrations?: Integration[];
|
||||
/** Whether the connection is verified */
|
||||
verified: boolean;
|
||||
/** Whether friend sync is enabled for this connection */
|
||||
friendSync: boolean;
|
||||
/** Whether activities related to this connection will be shown in presence updates */
|
||||
showActivity: boolean;
|
||||
/** Visibility of this connection */
|
||||
visibility: DiscordVisibilityTypes;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/user#connection-objecthttps://discord.com/developers/docs/resources/user#user-object-premium-types */
|
||||
export type DiscordConnection = SnakeCaseProps<Connection>;
|
||||
9
src/types/users/create_dm.ts
Normal file
9
src/types/users/create_dm.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { SnakeCaseProps } from "../util.ts";
|
||||
|
||||
export interface CreateDM {
|
||||
/** The recipient to open a DM channel with */
|
||||
recipientId: string;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/user#create-dm */
|
||||
export type DiscordCreateDM = SnakeCaseProps<CreateDM>;
|
||||
11
src/types/users/create_group_dm.ts
Normal file
11
src/types/users/create_group_dm.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { SnakeCaseProps } from "../util.ts";
|
||||
|
||||
export interface CreateGroupDM {
|
||||
/** Access tokens of users that have granted your app the `gdm.join` scope */
|
||||
accessTokens: string[];
|
||||
/** A dictionary of user ids to their respective nicknames */
|
||||
nicks: Record<string, string>;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/user#create-group-dm */
|
||||
export type DiscordCreateGroupDM = SnakeCaseProps<CreateGroupDM>;
|
||||
9
src/types/users/modify_current_user.ts
Normal file
9
src/types/users/modify_current_user.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export interface ModifyCurrentUser {
|
||||
/** User's username, if changed may cause the user's discriminator to be randomized. */
|
||||
username?: string;
|
||||
/** If passed, modifies the user's avatar */
|
||||
avatar?: string;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/user#modify-current-user */
|
||||
export type DiscordModifyCurrentUser = ModifyCurrentUser;
|
||||
6
src/types/users/premium_types.ts
Normal file
6
src/types/users/premium_types.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
/** https://discord.com/developers/docs/resources/user#user-object-premium-types */
|
||||
export enum DiscordPremiumTypes {
|
||||
None,
|
||||
NitroClassic,
|
||||
Nitro,
|
||||
}
|
||||
35
src/types/users/user.ts
Normal file
35
src/types/users/user.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { SnakeCaseProps } from "../util.ts";
|
||||
import { DiscordPremiumTypes } from "./premium_types.ts";
|
||||
import { DiscordUserFlags } from "./user_flags.ts";
|
||||
|
||||
export interface User {
|
||||
/** The user's id */
|
||||
id: string;
|
||||
/** The user's username, not unique across the platform */
|
||||
username: string;
|
||||
/** The user's 4-digit discord-tag */
|
||||
discriminator: string;
|
||||
/** The user's avatar hash */
|
||||
avatar: string | null;
|
||||
/** Whether the user belongs to an OAuth2 application */
|
||||
bot?: boolean;
|
||||
/** Whether the user is an Official Discord System user (part of the urgent message system) */
|
||||
system?: boolean;
|
||||
/** Whether the user has two factor enabled on their account */
|
||||
mfaEnabled?: boolean;
|
||||
/** The user's chosen language option */
|
||||
locale?: string;
|
||||
/** Whether the email on this account has been verified */
|
||||
verified?: boolean;
|
||||
/** The user's email */
|
||||
email?: string | null;
|
||||
/** The flags on a user's account */
|
||||
flags?: DiscordUserFlags;
|
||||
/** The type of Nitro subscription on a user's account */
|
||||
premiumType?: DiscordPremiumTypes;
|
||||
/** The public flags on a user's account */
|
||||
publicFlags?: DiscordUserFlags;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/user#user-object */
|
||||
export type DiscordUser = SnakeCaseProps<User>;
|
||||
17
src/types/users/user_flags.ts
Normal file
17
src/types/users/user_flags.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/** https://discord.com/developers/docs/resources/user#user-object-user-flags */
|
||||
export enum DiscordUserFlags {
|
||||
None,
|
||||
DiscordEmployee = 1 << 0,
|
||||
ParteneredServerOwner = 1 << 1,
|
||||
HypeSquadEvents = 1 << 2,
|
||||
BugHunterLevel1 = 1 << 3,
|
||||
HouseBravery = 1 << 6,
|
||||
HouseBrilliance = 1 << 7,
|
||||
HouseBalance = 1 << 8,
|
||||
EarlySupporter = 1 << 9,
|
||||
TeamUser = 1 << 10,
|
||||
System = 1 << 12,
|
||||
BugHunterLevel2 = 1 << 14,
|
||||
VerifiedBot = 1 << 16,
|
||||
EarlyVerifiedBotDeveloper = 1 << 17,
|
||||
}
|
||||
7
src/types/users/visibility_types.ts
Normal file
7
src/types/users/visibility_types.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/** https://discord.com/developers/docs/resources/user#connection-object-visibility-types */
|
||||
export enum DiscordVisibilityTypes {
|
||||
/** Invisible to everyone except the user themselves */
|
||||
None,
|
||||
/** Visible to everyone */
|
||||
Everyone,
|
||||
}
|
||||
Reference in New Issue
Block a user