Skip to content

Commit

Permalink
Clear command bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathaniel Wood committed Oct 7, 2024
1 parent a2b6da7 commit 17b19fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/commands/moderation/clear.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ module.exports = class extends Command {
constructor(...args) {
super(...args, {
name: "clear",
aliases: ["clear", "c", "purge"],
aliases: ["cls", "purge"],
description: " Delete the specified amount of messages",
category: "Moderation",
usage: "purge [channel] [user] <message-count> [reason]",
usage: "purge <message-count> [reason]",
examples: [
"purge 20",
"purge #general 10",
Expand All @@ -31,6 +31,7 @@ module.exports = class extends Command {
const success = client.emoji.success;

const amount = parseInt(args[0]);
const channel = message.channel;
if (isNaN(amount) === true || !amount || amount < 0 || amount > 100)
return message.channel.sendCustom({
embeds: [
Expand Down
5 changes: 2 additions & 3 deletions src/slashCommands/moderation/clear.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ module.exports = {
const success = client.emoji.success;

const amount = interaction.options.getInteger("amount");
const channel =
interaction.guild.channels.cache.get(interaction.channel.id);
const channel = interaction.channel.id;
const reason = interaction.options.getString("reason");
interaction.deferReply({ ephemeral: true });

Expand Down Expand Up @@ -62,7 +61,7 @@ module.exports = {
new MessageEmbed()
.setDescription(
`
${fail} | Unable to find any messages from ${member}.
${fail} | Unable to find any messages.
`,
)
.setColor(interaction.client.color.red),
Expand Down

0 comments on commit 17b19fe

Please sign in to comment.