mirror of
https://github.com/danbulant/discord.js
synced 2026-06-04 23:31:04 +00:00
fix: Client#generateInvite resolving permissions incorrectly
This commit is contained in:
parent
ec9211c3ce
commit
8d065fa043
1 changed files with 4 additions and 9 deletions
|
|
@ -392,20 +392,15 @@ class Client extends BaseClient {
|
||||||
/**
|
/**
|
||||||
* Generates a link that can be used to invite the bot to a guild.
|
* Generates a link that can be used to invite the bot to a guild.
|
||||||
* <warn>This is only available when using a bot account.</warn>
|
* <warn>This is only available when using a bot account.</warn>
|
||||||
* @param {PermissionResolvable[]|number} [permissions] Permissions to request
|
* @param {PermissionResolvable} [permissions] Permissions to request
|
||||||
* @returns {Promise<string>}
|
* @returns {Promise<string>}
|
||||||
* @example
|
* @example
|
||||||
* client.generateInvite(['SEND_MESSAGES', 'MANAGE_GUILD', 'MENTION_EVERYONE'])
|
* client.generateInvite(['SEND_MESSAGES', 'MANAGE_GUILD', 'MENTION_EVERYONE'])
|
||||||
* .then(link => {
|
* .then(link => console.log(`Generated bot invite link: ${link}`))
|
||||||
* console.log(`Generated bot invite link: ${link}`);
|
* .catch(console.error);
|
||||||
* }).catch(console.error);
|
|
||||||
*/
|
*/
|
||||||
generateInvite(permissions) {
|
generateInvite(permissions) {
|
||||||
if (permissions) {
|
permissions = typeof permissions === 'undefined' ? 0 : Permissions.resolve(permissions);
|
||||||
if (permissions instanceof Array) permissions = Permissions.resolve(permissions);
|
|
||||||
} else {
|
|
||||||
permissions = 0;
|
|
||||||
}
|
|
||||||
return this.fetchApplication().then(application =>
|
return this.fetchApplication().then(application =>
|
||||||
`https://discordapp.com/oauth2/authorize?client_id=${application.id}&permissions=${permissions}&scope=bot`
|
`https://discordapp.com/oauth2/authorize?client_id=${application.id}&permissions=${permissions}&scope=bot`
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue