renamed OAuth2Application#reset to resetSecret and added resetToken (#1541)

This commit is contained in:
SpaceEEC
2017-06-25 00:26:09 +02:00
committed by Amish Shah
parent 7f8cc9c297
commit 201ecd25a2
3 changed files with 16 additions and 5 deletions

View File

@@ -408,7 +408,7 @@ class Client extends EventEmitter {
* @returns {Promise<OAuth2Application>}
*/
fetchApplication(id = '@me') {
return this.rest.api.oauth2.applications(id).get()
return this.api.oauth2.applications(id).get()
.then(app => new OAuth2Application(this, app));
}

View File

@@ -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];

View File

@@ -133,14 +133,25 @@ class OAuth2Application {
}
/**
* Reset the app's secret and bot token.
* Reset the app's secret.
* <warn>This is only available when using a user account.</warn>
* @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.
* <warn>This is only available when using a user account.</warn>
* @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}