mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
Add getOAuthApplication()
This commit is contained in:
@@ -861,6 +861,16 @@ Set the note of a user. This will only work for user accounts.
|
|||||||
- **callback** - `function` taking the following:
|
- **callback** - `function` taking the following:
|
||||||
- **error** - error if any occurred.
|
- **error** - error if any occurred.
|
||||||
|
|
||||||
|
getOAuthApplication(appID, `callback`)
|
||||||
|
~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Get data on an OAuth2 application
|
||||||
|
|
||||||
|
- **appID** - The target application ID. If none was specified, it defaults to "@me", which refers to the logged in user's application.
|
||||||
|
- **callback** - `function` taking the following:
|
||||||
|
- **error** - error if any occurred.
|
||||||
|
- **data** - the application data. Refer to `the official Discord API documentation entry <https://discordapp.com/developers/docs/topics/oauth2#get-current-application-information>`_ for data structure details
|
||||||
|
|
||||||
Events
|
Events
|
||||||
------
|
------
|
||||||
|
|
||||||
|
|||||||
@@ -1190,6 +1190,19 @@ var Client = (function (_EventEmitter) {
|
|||||||
return this.internal.removeFriend(user).then(dataCallback(callback), errorCallback(callback));
|
return this.internal.removeFriend(user).then(dataCallback(callback), errorCallback(callback));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// def getOAuthApplication
|
||||||
|
|
||||||
|
Client.prototype.getOAuthApplication = function getOAuthApplication(appID) {
|
||||||
|
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err, bans*/{} : arguments[1];
|
||||||
|
|
||||||
|
if (typeof appID === "function") {
|
||||||
|
// appID is the callback
|
||||||
|
callback = appID;
|
||||||
|
appID = null;
|
||||||
|
}
|
||||||
|
return this.internal.getOAuthApplication(appID).then(dataCallback(callback), errorCallback(callback));
|
||||||
|
};
|
||||||
|
|
||||||
// def awaitResponse
|
// def awaitResponse
|
||||||
|
|
||||||
Client.prototype.awaitResponse = function awaitResponse(msg) {
|
Client.prototype.awaitResponse = function awaitResponse(msg) {
|
||||||
|
|||||||
@@ -1764,6 +1764,13 @@ var InternalClient = (function () {
|
|||||||
return this.apiRequest("delete", _Constants.Endpoints.FRIENDS + "/" + user.id, true);
|
return this.apiRequest("delete", _Constants.Endpoints.FRIENDS + "/" + user.id, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//def getOAuthApplication
|
||||||
|
|
||||||
|
InternalClient.prototype.getOAuthApplication = function getOAuthApplication(appID) {
|
||||||
|
appID = appID || "@me";
|
||||||
|
return this.apiRequest("get", _Constants.Endpoints.OAUTH2_APPLICATION(appID), true);
|
||||||
|
};
|
||||||
|
|
||||||
//def ack
|
//def ack
|
||||||
|
|
||||||
InternalClient.prototype.ack = function ack(msg) {
|
InternalClient.prototype.ack = function ack(msg) {
|
||||||
|
|||||||
@@ -1176,6 +1176,17 @@ export default class Client extends EventEmitter {
|
|||||||
.then(dataCallback(callback), errorCallback(callback));
|
.then(dataCallback(callback), errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// def getOAuthApplication
|
||||||
|
getOAuthApplication(appID, callback = (/*err, bans*/) => { }) {
|
||||||
|
if (typeof appID === "function") {
|
||||||
|
// appID is the callback
|
||||||
|
callback = appID;
|
||||||
|
appID = null;
|
||||||
|
}
|
||||||
|
return this.internal.getOAuthApplication(appID)
|
||||||
|
.then(dataCallback(callback), errorCallback(callback));
|
||||||
|
}
|
||||||
|
|
||||||
// def awaitResponse
|
// def awaitResponse
|
||||||
awaitResponse(msg, toSend = null, options = null, callback = (/*err, newMsg*/) => { }) {
|
awaitResponse(msg, toSend = null, options = null, callback = (/*err, newMsg*/) => { }) {
|
||||||
var ret;
|
var ret;
|
||||||
|
|||||||
@@ -1537,6 +1537,12 @@ export default class InternalClient {
|
|||||||
return this.apiRequest("delete", `${Endpoints.FRIENDS}/${user.id}`, true);
|
return this.apiRequest("delete", `${Endpoints.FRIENDS}/${user.id}`, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//def getOAuthApplication
|
||||||
|
getOAuthApplication(appID) {
|
||||||
|
appID = appID || "@me";
|
||||||
|
return this.apiRequest("get", Endpoints.OAUTH2_APPLICATION(appID), true);
|
||||||
|
}
|
||||||
|
|
||||||
//def ack
|
//def ack
|
||||||
ack(msg) {
|
ack(msg) {
|
||||||
msg = this.resolver.resolveMessage(msg);
|
msg = this.resolver.resolveMessage(msg);
|
||||||
|
|||||||
Reference in New Issue
Block a user