Downgrade to v13

[vi] cảm giác đau khổ
This commit is contained in:
March 7th
2022-03-24 17:55:32 +07:00
parent 9596b1a210
commit 7dfdef46a5
218 changed files with 8584 additions and 9108 deletions
+8 -5
View File
@@ -1,6 +1,5 @@
'use strict';
const { ChannelType, Routes } = require('discord-api-types/v9');
const CachedManager = require('./CachedManager');
const { GuildMember } = require('../structures/GuildMember');
const { Message } = require('../structures/Message');
@@ -39,7 +38,7 @@ class UserManager extends CachedManager {
* @private
*/
dmChannel(userId) {
return this.client.channels.cache.find(c => c.type === ChannelType.DM && c.recipient.id === userId) ?? null;
return this.client.channels.cache.find(c => c.type === 'DM' && c.recipient.id === userId) ?? null;
}
/**
@@ -56,7 +55,11 @@ class UserManager extends CachedManager {
if (dmChannel && !dmChannel.partial) return dmChannel;
}
const data = await this.client.api.users('@me').channels.post({ body: { recipient_id: id } });
const data = await this.client.api.users(this.client.user.id).channels.post({
data: {
recipient_id: id,
},
});
return this.client.channels._add(data, null, { cache });
}
@@ -69,7 +72,7 @@ class UserManager extends CachedManager {
const id = this.resolveId(user);
const dmChannel = this.dmChannel(id);
if (!dmChannel) throw new Error('USER_NO_DM_CHANNEL');
await this.client.channels(dmChannel.id).delete();
await this.client.api.channels(dmChannel.id).delete();
this.client.channels._remove(dmChannel.id);
return dmChannel;
}
@@ -97,7 +100,7 @@ class UserManager extends CachedManager {
* Fetches a user's flags.
* @param {UserResolvable} user The UserResolvable to identify
* @param {BaseFetchOptions} [options] Additional options for this fetch
* @returns {Promise<UserFlagsBitField>}
* @returns {Promise<UserFlags>}
*/
async fetchFlags(user, options) {
return (await this.fetch(user, options)).flags;