it works but we may need a captcha key
This commit is contained in:
parent
1f587eff99
commit
8bccb552db
@ -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`
|
||||
}
|
||||
});
|
||||
|
||||
|
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@ -337,7 +337,7 @@ export abstract class Application extends Base {
|
||||
public coverURL(options?: StaticImageURLOptions): string | null;
|
||||
/** @deprecated This method is deprecated as it is unsupported and will be removed in the next major version. */
|
||||
public fetchAssets(): Promise<ApplicationAsset[]>;
|
||||
public invite(guildID: string, permissions: number): Promise<ClientApplication>;
|
||||
public invite(guildID: string, permissions: number, captcha: string): Promise<ClientApplication>;
|
||||
public iconURL(options?: StaticImageURLOptions): string | null;
|
||||
public toJSON(): unknown;
|
||||
public toString(): string | null;
|
||||
|
Loading…
Reference in New Issue
Block a user