Skip to content

Commit

Permalink
refactor(guildbanmanager)!: rename days option to deleteMessageDays (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ImRodry authored Feb 13, 2022
1 parent ae0f35f commit 0dfdb2c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/discord.js/src/managers/GuildBanManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class GuildBanManager extends CachedManager {
/**
* Options used to ban a user from a guild.
* @typedef {Object} BanOptions
* @property {number} [days] Number of days of messages to delete, must be between 0 and 7, inclusive
* @property {number} [deleteMessageDays] Number of days of messages to delete, must be between 0 and 7, inclusive
* @property {string} [reason] The reason for the ban
*/

Expand All @@ -142,7 +142,7 @@ class GuildBanManager extends CachedManager {
const id = this.client.users.resolveId(user);
if (!id) throw new Error('BAN_RESOLVE_ID', true);
await this.client.rest.put(Routes.guildBan(this.guild.id, id), {
body: { delete_message_days: options.days },
body: { delete_message_days: options.deleteMessageDays },
reason: options.reason,
});
if (user instanceof GuildMember) return user;
Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/src/managers/GuildMemberManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ class GuildMemberManager extends CachedManager {
* .then(banInfo => console.log(`Banned ${banInfo.user?.tag ?? banInfo.tag ?? banInfo}`))
* .catch(console.error);
*/
ban(user, options = { days: 0 }) {
ban(user, options) {
return this.guild.bans.create(user, options);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/src/structures/GuildMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ class GuildMember extends Base {
* @returns {Promise<GuildMember>}
* @example
* // ban a guild member
* guildMember.ban({ days: 7, reason: 'They deserved it' })
* guildMember.ban({ deleteMessageDays: 7, reason: 'They deserved it' })
* .then(console.log)
* .catch(console.error);
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3402,7 +3402,7 @@ export interface AwaitReactionsOptions extends ReactionCollectorOptions {
}

export interface BanOptions {
days?: number;
deleteMessageDays?: number;
reason?: string;
}

Expand Down

0 comments on commit 0dfdb2c

Please sign in to comment.