bot inviting is somewhat working

This commit is contained in:
TheDevYellowy 2022-07-30 05:22:31 -05:00
parent 6b698183f9
commit f95436f44b
2 changed files with 25 additions and 0 deletions

View File

@ -142,6 +142,30 @@ class ClientApplication extends Application {
this._patch(app.application); this._patch(app.application);
return this; return this;
} }
/**
* Invites this application to a guild / server
* @param {string} guildID The id of the guild that you want to invite the bot to
* @param {number} permissions The permissions for the bot in number form
* @returns {Promise<ClientApplication>}
*/
async invite(guildID, permissions = 8) {
let res = await this.client.api.oauth2.authorize.post({
query: {
client_id: this.id,
scope: 'bot applications.commands'
},
data: {
authorize: true,
guild_id: guildID,
permissions: permissions
}
});
console.log(res)
return this;
}
} }
module.exports = ClientApplication; module.exports = ClientApplication;

1
typings/index.d.ts vendored
View File

@ -874,6 +874,7 @@ export class ClientApplication extends Application {
public readonly partial: boolean; public readonly partial: boolean;
public rpcOrigins: string[]; public rpcOrigins: string[];
public fetch(): Promise<ClientApplication>; public fetch(): Promise<ClientApplication>;
public invite(guildID: string, permissions: number): Promise<ClientApplication>;
} }
export class ClientPresence extends Presence { export class ClientPresence extends Presence {