it works but we may need a captcha key

This commit is contained in:
TheDevYellowy
2022-08-01 09:55:30 -05:00
parent 1f587eff99
commit 8bccb552db
2 changed files with 13 additions and 4 deletions

View File

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