Refactor OAuth application stuff

This commit is contained in:
Schuyler Cebulskie
2016-10-30 16:55:08 -04:00
parent 589c44327a
commit 85330769a7
6 changed files with 18 additions and 18 deletions

View File

@@ -327,13 +327,13 @@ class Client extends EventEmitter {
}
/**
* Get's the bot's OAuth2 app.
* Gets the bot's OAuth2 application.
* <warn>This is only available for bot accounts.</warn>
* @returns {Promise<ClientOAuth2App>}
*/
getMyApp() {
fetchApplication() {
if (!this.user.bot) throw new Error(Constants.Errors.NO_BOT_ACCOUNT);
return this.rest.methods.getMyApp();
return this.rest.methods.getMyApplication();
}
setTimeout(fn, ...params) {

View File

@@ -10,7 +10,7 @@ const Role = requireStructure('Role');
const Invite = requireStructure('Invite');
const Webhook = requireStructure('Webhook');
const UserProfile = requireStructure('UserProfile');
const ClientOAuth2App = requireStructure('ClientOAuth2App');
const ClientOAuth2Application = requireStructure('ClientOAuth2Application');
class RESTMethods {
constructor(restManager) {
@@ -611,9 +611,9 @@ class RESTMethods {
return this.rest.makeRequest('get', Constants.Endpoints.messageReaction(channelID, messageID, emoji, limit), true);
}
getMyApp() {
return this.rest.makeRequest('get', Constants.Endpoints.myApp, true).then(app =>
new ClientOAuth2App(this.rest.client, app)
getMyApplication() {
return this.rest.makeRequest('get', Constants.Endpoints.myApplication, true).then(app =>
new ClientOAuth2Application(this.rest.client, app)
);
}
}