chore(release): v2.3.75

- fix: VoiceStateUpdate event not working (DM channels + Group DM channels)
- docs: add sendSlash method
- feat: Add new Event: callCreate, callUpdate, callDelete
- fix(GroupDM): method require Class
This commit is contained in:
March 7th
2022-07-15 17:26:25 +07:00
parent fb6ab3f8e8
commit fad6d708b4
17 changed files with 826 additions and 780 deletions

View File

@@ -3,6 +3,7 @@
const { default: Collection } = require('@discordjs/collection');
const Base = require('./Base');
const ClientApplication = require('./ClientApplication');
const VoiceState = require('./VoiceState');
const TextBasedChannel = require('./interfaces/TextBasedChannel');
const { Error } = require('../errors');
const { RelationshipTypes } = require('../util/Constants');
@@ -189,6 +190,15 @@ class User extends Base {
return this.client.user.notes.get(this.id);
}
/**
* The voice state of this member
* @type {VoiceState}
* @readonly
*/
get voice() {
return this.client.voiceStates.cache.get(this.id) ?? new VoiceState({ client: this.client }, { user_id: this.id });
}
_ProfilePatch(data) {
if (!data) return;
@@ -351,6 +361,26 @@ class User extends Base {
return this.client.rest.cdn.Banner(this.id, this.banner, format, size, dynamic);
}
ring() {
if (!this.dmChannel?.id) return Promise.reject(new Error('USER_NO_DM_CHANNEL'));
if (!this.client.user.voice?.channelId || !this.client.callVoice) {
return Promise.reject(new Error('CLIENT_NO_CALL'));
}
return new Promise((resolve, reject) => {
this.client.api
.channels(this.dmChannel.id)
.call.ring.post({
data: {
recipients: [this.id],
},
})
.then(() => resolve(true))
.catch(e => {
reject(e);
});
});
}
/**
* The Discord "tag" (e.g. `hydrabolt#0001`) for this user
* @type {?string}