Skip to content

Commit

Permalink
Update: Some small little changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathaniel Wood committed Oct 8, 2024
1 parent a59278c commit a69778d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
29 changes: 8 additions & 21 deletions src/commands/moderation/clear.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = class extends Command {

const amount = parseInt(args[0]);
const channel = message.channel;
if (isNaN(amount) === true || !amount || amount < 0 || amount > 200)
if (isNaN(amount) === true || !amount || amount < 0 || amount > 200) {
return message.channel.sendCustom({
embeds: [
new MessageEmbed()
Expand All @@ -47,28 +47,15 @@ module.exports = class extends Command {
.setColor(message.guild.me.displayHexColor),
],
});

if (!channel.permissionsFor(message.guild.me).has(["MANAGE_MESSAGES"]))
return message.channel.sendCustom({
embeds: [
new MessageEmbed()
.setAuthor(
`${message.author.tag}`,
message.author.displayAvatarURL({ dynamic: true })
)
.setTitle(`${fail} Clear Error`)
.setDescription(
`Please make sure I have the **Manage Messages** Permission!`
)
.setTimestamp()
.setFooter({ text: `${process.env.AUTH_DOMAIN}` })
.setColor(message.guild.me.displayHexColor),
],
});
}

let reason = args.slice(1).join(" ");
if (!reason) reason = "None";
if (reason.length > 1024) reason = reason.slice(0, 1021) + "...";
if (!reason) {
reason = "None";
}
if (reason.length > 1024) {
reason = reason.slice(0, 1021) + "...";
}

await message.delete();

Expand Down
6 changes: 6 additions & 0 deletions src/slashCommands/moderation/clear.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ module.exports = {
const amount = interaction.options.getInteger("amount");
const channel = interaction.channel;
const reason = interaction.options.getString("reason");
if (!reason) {
reason = "None";
}
if (reason.length > 1024) {
reason = reason.slice(0, 1021) + "...";
}

if (amount < 0 || amount > 200) {
let invalidamount = new MessageEmbed()
Expand Down

0 comments on commit a69778d

Please sign in to comment.