diff --git a/src/client/Client.js b/src/client/Client.js index beacfcc6e..8d2d0803b 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -392,20 +392,15 @@ class Client extends BaseClient { /** * Generates a link that can be used to invite the bot to a guild. * This is only available when using a bot account. - * @param {PermissionResolvable[]|number} [permissions] Permissions to request + * @param {PermissionResolvable} [permissions] Permissions to request * @returns {Promise} * @example * client.generateInvite(['SEND_MESSAGES', 'MANAGE_GUILD', 'MENTION_EVERYONE']) - * .then(link => { - * console.log(`Generated bot invite link: ${link}`); - * }).catch(console.error); + * .then(link => console.log(`Generated bot invite link: ${link}`)) + * .catch(console.error); */ generateInvite(permissions) { - if (permissions) { - if (permissions instanceof Array) permissions = Permissions.resolve(permissions); - } else { - permissions = 0; - } + permissions = typeof permissions === 'undefined' ? 0 : Permissions.resolve(permissions); return this.fetchApplication().then(application => `https://discordapp.com/oauth2/authorize?client_id=${application.id}&permissions=${permissions}&scope=bot` );