diff --git a/src/types/users/connection.ts b/src/types/users/connection.ts new file mode 100644 index 000000000..97e638452 --- /dev/null +++ b/src/types/users/connection.ts @@ -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; diff --git a/src/types/users/create_dm.ts b/src/types/users/create_dm.ts new file mode 100644 index 000000000..0239d5ef6 --- /dev/null +++ b/src/types/users/create_dm.ts @@ -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; diff --git a/src/types/users/create_group_dm.ts b/src/types/users/create_group_dm.ts new file mode 100644 index 000000000..27f8c833b --- /dev/null +++ b/src/types/users/create_group_dm.ts @@ -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; +} + +/** https://discord.com/developers/docs/resources/user#create-group-dm */ +export type DiscordCreateGroupDM = SnakeCaseProps; diff --git a/src/types/users/modify_current_user.ts b/src/types/users/modify_current_user.ts new file mode 100644 index 000000000..adf2d5229 --- /dev/null +++ b/src/types/users/modify_current_user.ts @@ -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; diff --git a/src/types/users/premium_types.ts b/src/types/users/premium_types.ts new file mode 100644 index 000000000..ac5d460a5 --- /dev/null +++ b/src/types/users/premium_types.ts @@ -0,0 +1,6 @@ +/** https://discord.com/developers/docs/resources/user#user-object-premium-types */ +export enum DiscordPremiumTypes { + None, + NitroClassic, + Nitro, +} diff --git a/src/types/users/user.ts b/src/types/users/user.ts new file mode 100644 index 000000000..d6b0db122 --- /dev/null +++ b/src/types/users/user.ts @@ -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; diff --git a/src/types/users/user_flags.ts b/src/types/users/user_flags.ts new file mode 100644 index 000000000..fa800e203 --- /dev/null +++ b/src/types/users/user_flags.ts @@ -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, +} diff --git a/src/types/users/visibility_types.ts b/src/types/users/visibility_types.ts new file mode 100644 index 000000000..b8909728d --- /dev/null +++ b/src/types/users/visibility_types.ts @@ -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, +}