mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
@@ -324,6 +324,15 @@ class Client extends EventEmitter {
|
||||
return messages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get's the bot's OAuth2 app. Only usable by bot accounts
|
||||
* @returns {Promise<ClientOAuth2App>}
|
||||
*/
|
||||
getMyApp() {
|
||||
if (!this.user.bot) throw new Error(Constants.Errors.NO_BOT_ACCOUNT);
|
||||
return this.rest.methods.getMyApp();
|
||||
}
|
||||
|
||||
setTimeout(fn, ...params) {
|
||||
const timeout = setTimeout(() => {
|
||||
fn();
|
||||
|
||||
@@ -10,6 +10,7 @@ const Role = requireStructure('Role');
|
||||
const Invite = requireStructure('Invite');
|
||||
const Webhook = requireStructure('Webhook');
|
||||
const UserProfile = requireStructure('UserProfile');
|
||||
const ClientOAuth2App = requireStructure('ClientOAuth2App');
|
||||
|
||||
class RESTMethods {
|
||||
constructor(restManager) {
|
||||
@@ -762,6 +763,14 @@ class RESTMethods {
|
||||
.then(resolve, reject);
|
||||
});
|
||||
}
|
||||
|
||||
getMyApp() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.rest.makeRequest('get', Constants.Endpoints.myApp, true)
|
||||
.then(app => resolve(new ClientOAuth2App(this.rest.client, app)))
|
||||
.catch(reject);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = RESTMethods;
|
||||
|
||||
Reference in New Issue
Block a user