diff --git a/src/client/Client.js b/src/client/Client.js index 107a2f0e9..553b9c584 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -408,7 +408,7 @@ class Client extends EventEmitter { * @returns {Promise} */ fetchApplication(id = '@me') { - return this.rest.api.oauth2.applications(id).get() + return this.api.oauth2.applications(id).get() .then(app => new OAuth2Application(this, app)); } diff --git a/src/client/rest/APIRouter.js b/src/client/rest/APIRouter.js index 20133822f..be7a6ecbe 100644 --- a/src/client/rest/APIRouter.js +++ b/src/client/rest/APIRouter.js @@ -7,7 +7,7 @@ const paramable = [ 'bans', 'emojis', 'pins', 'permissions', 'reactions', 'webhooks', 'messages', 'notes', 'roles', 'applications', - 'invites', + 'invites', 'bot', ]; const reflectors = ['toString', 'valueOf', 'inspect', Symbol.toPrimitive, util.inspect.custom]; diff --git a/src/structures/OAuth2Application.js b/src/structures/OAuth2Application.js index 52eb89a12..c35dcc78c 100644 --- a/src/structures/OAuth2Application.js +++ b/src/structures/OAuth2Application.js @@ -133,14 +133,25 @@ class OAuth2Application { } /** - * Reset the app's secret and bot token. + * Reset the app's secret. + * This is only available when using a user account. * @returns {OAuth2Application} */ - reset() { - return this.rest.api.oauth2.applications(this.id).reset.post() + resetSecret() { + return this.client.api.oauth2.applications(this.id).reset.post() .then(app => new OAuth2Application(this.client, app)); } + /** + * Reset the app's bot token. + * This is only available when using a user account. + * @returns {OAuth2Application} + */ + resetToken() { + return this.client.api.oauth2.applications(this.id).bot().reset.post() + .then(app => new OAuth2Application(this.client, Object.assign({}, this, { bot: app }))); + } + /** * When concatenated with a string, this automatically concatenates the app name rather than the app object. * @returns {string}