From baffbdb5412444d619de546986ec9328b1ee3349 Mon Sep 17 00:00:00 2001 From: Advaith Date: Wed, 12 Aug 2020 00:30:34 -0700 Subject: [PATCH] fix(Integration): user might not be present (#4691) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Antonio Román --- src/structures/Integration.js | 12 +++++++----- typings/index.d.ts | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/structures/Integration.js b/src/structures/Integration.js index 49a0227af..0bd673133 100644 --- a/src/structures/Integration.js +++ b/src/structures/Integration.js @@ -58,11 +58,13 @@ class Integration extends Base { */ this.role = this.guild.roles.cache.get(data.role_id); - /** - * The user for this integration - * @type {User} - */ - this.user = this.client.users.add(data.user); + if (data.user) { + /** + * The user for this integration + * @type {?User} + */ + this.user = this.client.users.add(data.user); + } /** * The account integration information diff --git a/typings/index.d.ts b/typings/index.d.ts index 340b2043b..504682caa 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -890,7 +890,7 @@ declare module 'discord.js' { public syncedAt: number; public syncing: boolean; public type: string; - public user: User; + public user?: User; public delete(reason?: string): Promise; public edit(data: IntegrationEditData, reason?: string): Promise; public sync(): Promise;