diff --git a/packages/discord.js/src/managers/GuildBanManager.js b/packages/discord.js/src/managers/GuildBanManager.js index 426dc65f1..9af9b55c5 100644 --- a/packages/discord.js/src/managers/GuildBanManager.js +++ b/packages/discord.js/src/managers/GuildBanManager.js @@ -1,5 +1,6 @@ 'use strict'; +const process = require('node:process'); const { Collection } = require('@discordjs/collection'); const { makeURLSearchParams } = require('@discordjs/rest'); const { Routes } = require('discord-api-types/v10'); @@ -8,6 +9,8 @@ const { TypeError, Error, ErrorCodes } = require('../errors'); const GuildBan = require('../structures/GuildBan'); const { GuildMember } = require('../structures/GuildMember'); +let deprecationEmittedForDeleteMessageDays = false; + /** * Manages API methods for GuildBans and stores their cache. * @extends {CachedManager} @@ -152,6 +155,17 @@ class GuildBanManager extends CachedManager { if (typeof options !== 'object') throw new TypeError(ErrorCodes.InvalidType, 'options', 'object', true); const id = this.client.users.resolveId(user); if (!id) throw new Error(ErrorCodes.BanResolveId, true); + + if (typeof options.deleteMessageDays !== 'undefined' && !deprecationEmittedForDeleteMessageDays) { + process.emitWarning( + // eslint-disable-next-line max-len + 'The deleteMessageDays option for GuildBanManager#create() is deprecated. Use the deleteMessageSeconds option instead.', + 'DeprecationWarning', + ); + + deprecationEmittedForDeleteMessageDays = true; + } + await this.client.rest.put(Routes.guildBan(this.guild.id, id), { body: { delete_message_seconds: