From 9430535e8314c5dc9de91c34ec6f6f83c910f8fb Mon Sep 17 00:00:00 2001 From: izexi <43889168+izexi@users.noreply.github.com> Date: Sat, 17 Aug 2019 19:31:04 +0100 Subject: [PATCH] feat(Invite): add targetUser(Type) (#3262) * add Invite#targetUser(Type) * incase discord decides to add 0 --- src/structures/Invite.js | 18 ++++++++++++++++++ typings/index.d.ts | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/src/structures/Invite.js b/src/structures/Invite.js index b73076a6070f..d5e9f895d5da 100644 --- a/src/structures/Invite.js +++ b/src/structures/Invite.js @@ -70,6 +70,24 @@ class Invite extends Base { */ this.inviter = data.inviter ? this.client.users.add(data.inviter) : null; + /** + * The target user for this invite + * @type {?User} + */ + this.targetUser = data.target_user ? this.client.users.add(data.target_user) : null; + + /** + * The type of the target user: + * * 1: STREAM + * @typedef {number} TargetUser + */ + + /** + * The target user type + * @type {?TargetUser} + */ + this.targetUserType = typeof data.target_user_type === 'number' ? data.target_user_type : null; + /** * The channel the invite is for * @type {Channel} diff --git a/typings/index.d.ts b/typings/index.d.ts index 3cb0c622a45c..877dfed320f2 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -928,6 +928,8 @@ declare module 'discord.js' { public maxUses: number | null; public memberCount: number; public presenceCount: number; + public targetUser: User | null; + public targetUserType: TargetUser | null; public temporary: boolean | null; public readonly url: string; public uses: number | null; @@ -2524,6 +2526,8 @@ declare module 'discord.js' { type StringResolvable = string | string[] | any; + type TargetUser = number; + type UserResolvable = User | Snowflake | Message | GuildMember; type VoiceStatus = number;