Downgrade to v13
[vi] cảm giác đau khổ
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { Collection } = require('@discordjs/collection');
|
||||
const { Routes } = require('discord-api-types/v9');
|
||||
const CachedManager = require('./CachedManager');
|
||||
const { TypeError, Error } = require('../errors');
|
||||
const GuildBan = require('../structures/GuildBan');
|
||||
@@ -120,7 +119,7 @@ class GuildBanManager extends CachedManager {
|
||||
/**
|
||||
* Options used to ban a user from a guild.
|
||||
* @typedef {Object} BanOptions
|
||||
* @property {number} [deleteMessageDays] Number of days of messages to delete, must be between 0 and 7, inclusive
|
||||
* @property {number} [days=0] Number of days of messages to delete, must be between 0 and 7, inclusive
|
||||
* @property {string} [reason] The reason for the ban
|
||||
*/
|
||||
|
||||
@@ -137,14 +136,17 @@ class GuildBanManager extends CachedManager {
|
||||
* .then(banInfo => console.log(`Banned ${banInfo.user?.tag ?? banInfo.tag ?? banInfo}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
async create(user, options = {}) {
|
||||
async create(user, options = { days: 0 }) {
|
||||
if (typeof options !== 'object') throw new TypeError('INVALID_TYPE', 'options', 'object', true);
|
||||
const id = this.client.users.resolveId(user);
|
||||
if (!id) throw new Error('BAN_RESOLVE_ID', true);
|
||||
await this.client.api.guilds(this.guild.id).bans(id).put({
|
||||
body: { delete_message_days: options.deleteMessageDays },
|
||||
reason: options.reason,
|
||||
});
|
||||
await this.client.api
|
||||
.guilds(this.guild.id)
|
||||
.bans(id)
|
||||
.put({
|
||||
data: { delete_message_days: options.days },
|
||||
reason: options.reason,
|
||||
});
|
||||
if (user instanceof GuildMember) return user;
|
||||
const _user = this.client.users.resolve(id);
|
||||
if (_user) {
|
||||
|
||||
Reference in New Issue
Block a user