feat(Application): tidy up code

This commit is contained in:
TheDevYellowy 2022-08-02 00:31:24 -05:00
parent 8797069acf
commit 56d6250638

View File

@ -80,30 +80,30 @@ class Application extends Base {
* @param {string} guild_id The id of the guild that you want to invite the bot to * @param {string} guild_id The id of the guild that you want to invite the bot to
* @param {bigint} [permissions] The permissions for the bot in number form (the default is 8 / Administrator) * @param {bigint} [permissions] The permissions for the bot in number form (the default is 8 / Administrator)
* @param {string} [captcha] The captcha key to add * @param {string} [captcha] The captcha key to add
* @returns nothing :) * @returns {undefined} nothing :)
*/ */
async invite(guild_id, permissions = 8, captcha = null) { async invite(guild_id, permissions = 8, captcha = null) {
let res = await this.client.api.oauth2.authorize.post({ await this.client.api.oauth2.authorize.post({
query: { query: {
client_id: this.id, client_id: this.id,
scope: 'bot applications.commands' scope: 'bot applications.commands',
}, },
data: captcha ? { data: captcha
? {
captcha_key: captcha, captcha_key: captcha,
authorize: true, authorize: true,
guild_id, guild_id,
permissions, permissions,
} : { }
: {
authorize: true, authorize: true,
guild_id, guild_id,
permissions, permissions,
}, },
headers: { headers: {
"referer": `https://discord.com/oauth2/authorize?client_id=${this.id}&permissions=${permissions}&scope=bot` referer: `https://discord.com/oauth2/authorize?client_id=${this.id}&permissions=${permissions}&scope=bot`,
} },
}); });
return;
} }
/** /**