mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
Working friends support with events and requests
This commit is contained in:
@@ -115,6 +115,48 @@ export default class Client extends 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);
|
||||
* }
|
||||
*/
|
||||
get friends() {
|
||||
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);
|
||||
* }
|
||||
*/
|
||||
get incomingFriendRequests() {
|
||||
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);
|
||||
* }
|
||||
*/
|
||||
get outgoingFriendRequests() {
|
||||
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).
|
||||
@@ -912,6 +954,18 @@ export default class Client extends EventEmitter {
|
||||
.then(dataCallback(callback), errorCallback(callback));
|
||||
}
|
||||
|
||||
// def addFriend
|
||||
addFriend(user, callback = (/*err, {}*/) => {}) {
|
||||
return this.internal.addFriend(user)
|
||||
.then(dataCallback(callback), errorCallback(callback));
|
||||
}
|
||||
|
||||
// def removeFriend
|
||||
removeFriend(user, callback = (/*err, {}*/) => {}) {
|
||||
return this.internal.removeFriend(user)
|
||||
.then(dataCallback(callback), errorCallback(callback));
|
||||
}
|
||||
|
||||
// def awaitResponse
|
||||
awaitResponse(msg, toSend = null, options = null, callback = (/*err, newMsg*/) => { }) {
|
||||
var ret;
|
||||
|
||||
Reference in New Issue
Block a user