mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
Working friends support with events and requests
This commit is contained in:
@@ -953,6 +953,22 @@ var Client = (function (_EventEmitter) {
|
||||
return this.internal.leaveVoiceChannel().then(dataCallback(callback), errorCallback(callback));
|
||||
};
|
||||
|
||||
// def addFriend
|
||||
|
||||
Client.prototype.addFriend = function addFriend(user) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err, {}*/{} : arguments[1];
|
||||
|
||||
return this.internal.addFriend(user).then(dataCallback(callback), errorCallback(callback));
|
||||
};
|
||||
|
||||
// def removeFriend
|
||||
|
||||
Client.prototype.removeFriend = function removeFriend(user) {
|
||||
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () /*err, {}*/{} : arguments[1];
|
||||
|
||||
return this.internal.removeFriend(user).then(dataCallback(callback), errorCallback(callback));
|
||||
};
|
||||
|
||||
// def awaitResponse
|
||||
|
||||
Client.prototype.awaitResponse = function awaitResponse(msg) {
|
||||
@@ -1093,6 +1109,54 @@ var Client = (function (_EventEmitter) {
|
||||
return this.internal.private_channels;
|
||||
}
|
||||
|
||||
/**
|
||||
* The friends that the Client is aware of. Only available after `ready` event has been emitted.
|
||||
* @type {Cache<User>|null} a Cache of friend Users (or null if bot account)
|
||||
* @readonly
|
||||
* @example
|
||||
* // log names of the friends that the client is aware of
|
||||
* for(var user of client.friends){
|
||||
* console.log(user.username);
|
||||
* }
|
||||
*/
|
||||
}, {
|
||||
key: "friends",
|
||||
get: function get() {
|
||||
return this.internal.friends;
|
||||
}
|
||||
|
||||
/**
|
||||
* The incoming friend requests that the Client is aware of. Only available after `ready` event has been emitted.
|
||||
* @type {Cache<User>|null} a Cache of incoming friend request Users (or null if bot account)
|
||||
* @readonly
|
||||
* @example
|
||||
* // log names of the incoming friend requests that the client is aware of
|
||||
* for(var user of client.incomingFriendRequests){
|
||||
* console.log(user.username);
|
||||
* }
|
||||
*/
|
||||
}, {
|
||||
key: "incomingFriendRequests",
|
||||
get: function get() {
|
||||
return this.internal.incoming_friend_requests;
|
||||
}
|
||||
|
||||
/**
|
||||
* The outgoing friend requests that the Client is aware of. Only available after `ready` event has been emitted.
|
||||
* @type {Cache<User>} a Cache of outgoing friend request Users
|
||||
* @readonly
|
||||
* @example
|
||||
* // log names of the outgoing friend requests that the client is aware of
|
||||
* for(var user of client.outgoingFriendRequests){
|
||||
* console.log(user.username);
|
||||
* }
|
||||
*/
|
||||
}, {
|
||||
key: "outgoingFriendRequests",
|
||||
get: function get() {
|
||||
return this.internal.outgoing_friend_requests;
|
||||
}
|
||||
|
||||
/**
|
||||
* The active voice connection of the Client, or null if not applicable. Only available after `ready` event has been emitted.
|
||||
* @type {VoiceConnection|null} the voice connection (if any).
|
||||
|
||||
Reference in New Issue
Block a user