move the invite function to Application

This commit is contained in:
TheDevYellowy
2022-07-31 00:42:51 -05:00
parent f95436f44b
commit 1f587eff99
3 changed files with 25 additions and 25 deletions

View File

@@ -142,30 +142,6 @@ class ClientApplication extends Application {
this._patch(app.application);
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;

View File

@@ -75,6 +75,30 @@ class Application extends Base {
return new Date(this.createdTimestamp);
}
/**
* 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
* @returns nothing :)
*/
async invite(guild_id, 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,
permissions,
}
});
console.log(res)
return;
}
/**
* A link to the application's icon.
* @param {StaticImageURLOptions} [options={}] Options for the Image URL