From 77f1c6a9e3ab0a0be8dcbcf70a6ee6250a1778cb Mon Sep 17 00:00:00 2001 From: UltimatePlayer97 Date: Tue, 4 Feb 2025 16:59:33 +1100 Subject: [PATCH 1/6] allow a channel to be specified --- src/commands/Moderation/slowmode.ts | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/commands/Moderation/slowmode.ts b/src/commands/Moderation/slowmode.ts index 1ba1015..ce4f4f4 100644 --- a/src/commands/Moderation/slowmode.ts +++ b/src/commands/Moderation/slowmode.ts @@ -7,7 +7,7 @@ import { export const data = { name: "slowmode", - description: "Changes the slowmode timer of the channel.", + description: "Changes the slowmode timer of a channel.", }; export const execute = async ( @@ -20,7 +20,7 @@ export const execute = async ( new EmbedBuilder() .setTitle("Slowmode Command Usage") .setDescription( - "`slowmode [time]` - Sets the slowmode of the current channel.\n" + + "`slowmode [time] [#channel]` - Sets the slowmode of the specified channel.\n" + "`slowmode help` - Shows this help message.\n\n" + "**Time Formats:**\n" + "- `5s` → 5 seconds\n" + @@ -65,9 +65,7 @@ export const execute = async ( await message.reply({ embeds: [ new EmbedBuilder() - .setDescription( - "❌ Please specify a valid time (e.g., `5s`, `2.5m`, `1h`)." - ) + .setDescription("❌ Please specify a valid time.") .setColor(0xff0000), ], }); @@ -79,7 +77,7 @@ export const execute = async ( await message.reply({ embeds: [ new EmbedBuilder() - .setDescription("❌ Invalid format. Use `5s`, `2.5m`, or `1h`.") + .setDescription("❌ Invalid format. Use `s`, `m`, or `h`.") .setColor(0xff0000), ], }); @@ -103,15 +101,22 @@ export const execute = async ( return; } - const channel = message.channel as TextChannel; + let targetChannel = message.mentions.channels.first() as + | TextChannel + | undefined; + if (!targetChannel) { + targetChannel = message.channel as TextChannel; + } try { - await channel.setRateLimitPerUser(Math.floor(slowmodeSeconds)); + await targetChannel.setRateLimitPerUser(Math.floor(slowmodeSeconds)); await message.reply({ embeds: [ new EmbedBuilder() .setDescription( - `✅ Slowmode set to **${Math.floor(slowmodeSeconds)} seconds**.` + `✅ Slowmode set to **${Math.floor( + slowmodeSeconds + )} seconds** in ${targetChannel}.` ) .setColor(0x5865f2), ], From a52be28759adcfc85c08f0831b1e1eaf683e0033 Mon Sep 17 00:00:00 2001 From: UltimatePlayer97 Date: Tue, 4 Feb 2025 17:02:29 +1100 Subject: [PATCH 2/6] show the author of the userinfo command --- src/commands/Misc/userinfo.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/Misc/userinfo.ts b/src/commands/Misc/userinfo.ts index 8380e92..ca3ad9d 100644 --- a/src/commands/Misc/userinfo.ts +++ b/src/commands/Misc/userinfo.ts @@ -48,7 +48,8 @@ export const execute = async ( } ) .setColor("Random") - .setTimestamp(); + .setTimestamp() + .setFooter({ text: `Requested by ${message.author.username}` }); await channel.send({ embeds: [embed] }); }; From 9e5c931d66d8d681da85ab0638c69f6d6cef5ac0 Mon Sep 17 00:00:00 2001 From: UltimatePlayer97 Date: Tue, 4 Feb 2025 17:12:46 +1100 Subject: [PATCH 3/6] change ping delay to 1 second --- src/commands/Misc/ping.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/Misc/ping.ts b/src/commands/Misc/ping.ts index efbd609..6faff12 100644 --- a/src/commands/Misc/ping.ts +++ b/src/commands/Misc/ping.ts @@ -14,7 +14,7 @@ export const execute = async (message: Message): Promise => { const sentMessage = await message.reply({ embeds: [embed] }); - await new Promise((res) => setTimeout(res, 3000)); + await new Promise((res) => setTimeout(res, 1000)); const latency = sentMessage.createdTimestamp - message.createdTimestamp; const apiLatency = message.client.ws.ping; From 3367a1edf7c2133f09e41a44dc6f9fce626f5e31 Mon Sep 17 00:00:00 2001 From: UltimatePlayer97 Date: Thu, 6 Feb 2025 18:01:41 +1100 Subject: [PATCH 4/6] prevent bot from crashing when not specifying a channel to unlock --- src/commands/Moderation/unlock.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/commands/Moderation/unlock.ts b/src/commands/Moderation/unlock.ts index fc45889..1012ad3 100644 --- a/src/commands/Moderation/unlock.ts +++ b/src/commands/Moderation/unlock.ts @@ -45,25 +45,25 @@ export const execute = async (message: Message, args: string[] = []) => { const channel = message.mentions.channels.first() as TextChannel; - const everyone_role = message.guild!.roles.everyone; - const overwrite = channel.permissionOverwrites.cache.get(everyone_role.id); - - if (!overwrite || !overwrite.deny.has(PermissionFlagsBits.SendMessages)) { + if (!channel) { await message.reply({ embeds: [ new EmbedBuilder() - .setDescription("❌ This channel is already unlocked.") + .setDescription("❌ Please specify a channel to unlock.") .setColor("#FF0000"), ], }); return; } - if (!channel) { + const everyone_role = message.guild!.roles.everyone; + const overwrite = channel.permissionOverwrites.cache.get(everyone_role.id); + + if (!overwrite || !overwrite.deny.has(PermissionFlagsBits.SendMessages)) { await message.reply({ embeds: [ new EmbedBuilder() - .setDescription("❌ Please specify a channel to unlock.") + .setDescription("❌ This channel is already unlocked.") .setColor("#FF0000"), ], }); From 4241334a9efb1ed5130faeef4d6af9609fd16f3e Mon Sep 17 00:00:00 2001 From: UltimatePlayer97 Date: Thu, 13 Feb 2025 17:02:46 +1100 Subject: [PATCH 5/6] Self delete messages for moderation commands --- src/commands/Moderation/ban.ts | 116 +++++++++++++----------- src/commands/Moderation/kick.ts | 14 +-- src/commands/Moderation/lock.ts | 10 +-- src/commands/Moderation/mute.ts | 18 ++-- src/commands/Moderation/purge.ts | 84 ++++++++++-------- src/commands/Moderation/slowmode.ts | 132 +++++++++++++++------------- src/commands/Moderation/unban.ts | 98 ++++++++++++--------- src/commands/Moderation/unlock.ts | 68 ++++++++------ src/commands/Moderation/unmute.ts | 14 +-- 9 files changed, 308 insertions(+), 246 deletions(-) diff --git a/src/commands/Moderation/ban.ts b/src/commands/Moderation/ban.ts index f0ebde4..640497d 100644 --- a/src/commands/Moderation/ban.ts +++ b/src/commands/Moderation/ban.ts @@ -25,19 +25,23 @@ export const execute = async ( ) .setColor("#5865f2"); - await message.reply({ embeds: [help_embed] }); + await message + .reply({ embeds: [help_embed] }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } if (!message.member.permissions.has(PermissionFlagsBits.BanMembers)) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ You don't have permission to ban members.") - .setColor("#FF0000") - .setTimestamp(), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ You don't have permission to ban members.") + .setColor("#FF0000") + .setTimestamp(), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } @@ -50,56 +54,64 @@ export const execute = async ( try { target = await message.guild.members.fetch(user_id); } catch (error) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ User ID not found.") - .setColor("#FF0000") - .setTimestamp(), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ User ID not found.") + .setColor("#FF0000") + .setTimestamp(), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } } } if (!target) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ Please mention a user to ban.") - .setColor("#FF0000") - .setTimestamp(), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ Please mention a user to ban.") + .setColor("#FF0000") + .setTimestamp(), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } if ( !message.guild.members.me?.permissions.has(PermissionFlagsBits.BanMembers) ) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ I don't have permission to ban members.") - .setColor("#FF0000") - .setTimestamp(), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ I don't have permission to ban members.") + .setColor("#FF0000") + .setTimestamp(), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } if (!target.bannable) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription( - "❌ I can't ban this user. They may have a higher role than me." - ) - .setColor("#FF0000") - .setTimestamp(), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription( + "❌ I can't ban this user. They may have a higher role than me." + ) + .setColor("#FF0000") + .setTimestamp(), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } @@ -136,13 +148,15 @@ export const execute = async ( }); } catch (error) { console.error(error); - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription(`❌ Failed to ban ${target.user.tag}.`) - .setColor("#5865f2") - .setTimestamp(), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription(`❌ Failed to ban ${target.user.tag}.`) + .setColor("#5865f2") + .setTimestamp(), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); } }; diff --git a/src/commands/Moderation/kick.ts b/src/commands/Moderation/kick.ts index 2753196..06f022d 100644 --- a/src/commands/Moderation/kick.ts +++ b/src/commands/Moderation/kick.ts @@ -26,7 +26,7 @@ export const execute = async ( ) .setColor(0x5865f2), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -37,7 +37,7 @@ export const execute = async ( .setDescription("❌ You don't have permission to kick members.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -50,7 +50,7 @@ export const execute = async ( .setDescription("❌ I don't have permission to kick members.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -70,7 +70,7 @@ export const execute = async ( .setDescription("❌ User ID not found.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } } @@ -83,7 +83,7 @@ export const execute = async ( .setDescription("❌ Please mention a user to kick.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -96,7 +96,7 @@ export const execute = async ( ) .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -138,6 +138,6 @@ export const execute = async ( .setDescription("❌ Failed to kick the user.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); } }; diff --git a/src/commands/Moderation/lock.ts b/src/commands/Moderation/lock.ts index 021678f..1918d42 100644 --- a/src/commands/Moderation/lock.ts +++ b/src/commands/Moderation/lock.ts @@ -33,7 +33,7 @@ export const execute = async (message: Message, args: string[] = []) => { ) .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -44,7 +44,7 @@ export const execute = async (message: Message, args: string[] = []) => { .setDescription("❌ You don't have permission to manage channels.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -57,7 +57,7 @@ export const execute = async (message: Message, args: string[] = []) => { .setDescription("❌ Please specify a channel to lock.`") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -71,7 +71,7 @@ export const execute = async (message: Message, args: string[] = []) => { .setDescription("❌ This channel is already locked.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -96,6 +96,6 @@ export const execute = async (message: Message, args: string[] = []) => { .setDescription("❌ Failed to lock the channel.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); } }; diff --git a/src/commands/Moderation/mute.ts b/src/commands/Moderation/mute.ts index 56a31c1..1e789a9 100644 --- a/src/commands/Moderation/mute.ts +++ b/src/commands/Moderation/mute.ts @@ -55,7 +55,7 @@ export const execute = async ( ) .setColor(0x5865f2), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -66,7 +66,7 @@ export const execute = async ( .setDescription("❌ You don't have permission to mute members.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -81,7 +81,7 @@ export const execute = async ( .setDescription("❌ I don't have permission to mute members.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -101,7 +101,7 @@ export const execute = async ( .setDescription("❌ User ID not found.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } } @@ -114,7 +114,7 @@ export const execute = async ( .setDescription("❌ Please mention a user or provide their ID.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -127,7 +127,7 @@ export const execute = async ( ) .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -142,7 +142,7 @@ export const execute = async ( ) .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -156,7 +156,7 @@ export const execute = async ( ) .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -194,6 +194,6 @@ export const execute = async ( .setDescription("❌ Failed to mute the user.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000));; } }; diff --git a/src/commands/Moderation/purge.ts b/src/commands/Moderation/purge.ts index c10aa11..ef89657 100644 --- a/src/commands/Moderation/purge.ts +++ b/src/commands/Moderation/purge.ts @@ -23,7 +23,9 @@ export const execute = async ( ) .setColor("#5865f2"); - await message.reply({ embeds: [help_embed] }); + await message + .reply({ embeds: [help_embed] }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } @@ -33,46 +35,54 @@ export const execute = async ( ); if (!permission) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ You don't have permission to manage messages.") - .setColor("#FF0000"), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ You don't have permission to manage messages.") + .setColor("#FF0000"), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } if (isNaN(num)) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ Please provide a valid number.") - .setColor("#FF0000"), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ Please provide a valid number.") + .setColor("#FF0000"), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } if (num <= 0) { - message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ Please provide a number greater than 0.") - .setColor("#FF0000"), - ], - }); + message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ Please provide a number greater than 0.") + .setColor("#FF0000"), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } if (num > 100) { - message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("Calm down, I can only delete up to 100 messages") - .setColor("#FF0000"), - ], - }); + message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("Calm down, I can only delete up to 100 messages") + .setColor("#FF0000"), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } @@ -95,12 +105,14 @@ export const execute = async ( }, 5000); } catch (error) { console.error(error); - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ Failed to delete messages.") - .setColor("#FF0000"), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ Failed to delete messages.") + .setColor("#FF0000"), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); } }; diff --git a/src/commands/Moderation/slowmode.ts b/src/commands/Moderation/slowmode.ts index ce4f4f4..ab988fe 100644 --- a/src/commands/Moderation/slowmode.ts +++ b/src/commands/Moderation/slowmode.ts @@ -15,34 +15,38 @@ export const execute = async ( args: string[] = [] ): Promise => { if (args[0]?.toLowerCase() === "help") { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setTitle("Slowmode Command Usage") - .setDescription( - "`slowmode [time] [#channel]` - Sets the slowmode of the specified channel.\n" + - "`slowmode help` - Shows this help message.\n\n" + - "**Time Formats:**\n" + - "- `5s` → 5 seconds\n" + - "- `2m` → 2 minutes (120s)\n" + - "- `1h` → 1 hour (3600s)\n" + - "- `2.5m` → 2 minutes 30 seconds (150s)\n" + - "- `6h` → 6 hours (21600s, max limit)" - ) - .setColor(0x5865f2), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setTitle("Slowmode Command Usage") + .setDescription( + "`slowmode [time] [#channel]` - Sets the slowmode of the specified channel.\n" + + "`slowmode help` - Shows this help message.\n\n" + + "**Time Formats:**\n" + + "- `5s` → 5 seconds\n" + + "- `2m` → 2 minutes (120s)\n" + + "- `1h` → 1 hour (3600s)\n" + + "- `2.5m` → 2 minutes 30 seconds (150s)\n" + + "- `6h` → 6 hours (21600s, max limit)" + ) + .setColor(0x5865f2), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } if (!message.member?.permissions.has(PermissionFlagsBits.ManageMessages)) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ You don't have permission to set slowmode.") - .setColor(0xff0000), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ You don't have permission to set slowmode.") + .setColor(0xff0000), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } @@ -51,36 +55,42 @@ export const execute = async ( PermissionFlagsBits.ManageMessages ) ) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ I don't have permission to set slowmode.") - .setColor(0xff0000), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ I don't have permission to set slowmode.") + .setColor(0xff0000), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } if (!args[0]) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ Please specify a valid time.") - .setColor(0xff0000), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ Please specify a valid time.") + .setColor(0xff0000), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } const timeMatch = args[0].match(/^(\d*\.?\d+)([smh])$/); if (!timeMatch) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ Invalid format. Use `s`, `m`, or `h`.") - .setColor(0xff0000), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ Invalid format. Use `s`, `m`, or `h`.") + .setColor(0xff0000), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } @@ -91,13 +101,15 @@ export const execute = async ( else if (unit === "h") slowmodeSeconds *= 3600; if (slowmodeSeconds > 21600) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ Maximum slowmode is 6 hours (21600 seconds).") - .setColor(0xff0000), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ Maximum slowmode is 6 hours (21600 seconds).") + .setColor(0xff0000), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } @@ -122,12 +134,14 @@ export const execute = async ( ], }); } catch { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ Failed to set slowmode.") - .setColor(0xff0000), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ Failed to set slowmode.") + .setColor(0xff0000), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); } }; diff --git a/src/commands/Moderation/unban.ts b/src/commands/Moderation/unban.ts index ea33e15..683d05c 100644 --- a/src/commands/Moderation/unban.ts +++ b/src/commands/Moderation/unban.ts @@ -30,46 +30,54 @@ export const execute = async ( ) .setColor("#5865f2"); - await message.reply({ embeds: [help_embed] }); + await message + .reply({ embeds: [help_embed] }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } if (!message.member.permissions.has(PermissionFlagsBits.BanMembers)) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ You don't have permission to unban members.") - .setColor("#FF0000") - .setTimestamp(), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ You don't have permission to unban members.") + .setColor("#FF0000") + .setTimestamp(), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } const user_id = args[0]; if (!user_id) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ Please mention a user to unban.") - .setColor("#FF0000") - .setTimestamp(), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ Please mention a user to unban.") + .setColor("#FF0000") + .setTimestamp(), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } if ( !message.guild.members.me?.permissions.has(PermissionFlagsBits.BanMembers) ) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ I don't have permission to unban members.") - .setColor("#FF0000") - .setTimestamp(), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ I don't have permission to unban members.") + .setColor("#FF0000") + .setTimestamp(), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } @@ -80,14 +88,16 @@ export const execute = async ( const banned_user = bans.get(user_id); if (!banned_user) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ This user is not banned.") - .setColor("#FF0000") - .setTimestamp(), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ This user is not banned.") + .setColor("#FF0000") + .setTimestamp(), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } @@ -104,15 +114,17 @@ export const execute = async ( }); } catch (error) { console.error(error); - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription( - "❌ Failed to unban the user. Make sure the ID is correct." - ) - .setColor("#FF0000") - .setTimestamp(), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription( + "❌ Failed to unban the user. Make sure the ID is correct." + ) + .setColor("#FF0000") + .setTimestamp(), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); } }; diff --git a/src/commands/Moderation/unlock.ts b/src/commands/Moderation/unlock.ts index 1012ad3..6a09c92 100644 --- a/src/commands/Moderation/unlock.ts +++ b/src/commands/Moderation/unlock.ts @@ -28,31 +28,37 @@ export const execute = async (message: Message, args: string[] = []) => { ) .setColor(0x00ff00); - await message.reply({ embeds: [helpEmbed] }); + await message + .reply({ embeds: [helpEmbed] }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } if (!message.member?.permissions.has(PermissionFlagsBits.ManageChannels)) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ You don't have permission to manage channels.") - .setColor("#FF0000"), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ You don't have permission to manage channels.") + .setColor("#FF0000"), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } const channel = message.mentions.channels.first() as TextChannel; if (!channel) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ Please specify a channel to unlock.") - .setColor("#FF0000"), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ Please specify a channel to unlock.") + .setColor("#FF0000"), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } @@ -60,13 +66,15 @@ export const execute = async (message: Message, args: string[] = []) => { const overwrite = channel.permissionOverwrites.cache.get(everyone_role.id); if (!overwrite || !overwrite.deny.has(PermissionFlagsBits.SendMessages)) { - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ This channel is already unlocked.") - .setColor("#FF0000"), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ This channel is already unlocked.") + .setColor("#FF0000"), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); return; } @@ -85,12 +93,14 @@ export const execute = async (message: Message, args: string[] = []) => { }); } catch (error) { console.error(error); - await message.reply({ - embeds: [ - new EmbedBuilder() - .setDescription("❌ Failed to unlock the channel.") - .setColor("#FF0000"), - ], - }); + await message + .reply({ + embeds: [ + new EmbedBuilder() + .setDescription("❌ Failed to unlock the channel.") + .setColor("#FF0000"), + ], + }) + .then((msg) => setTimeout(() => msg.delete(), 5000)); } }; diff --git a/src/commands/Moderation/unmute.ts b/src/commands/Moderation/unmute.ts index 29f91a2..6753abe 100644 --- a/src/commands/Moderation/unmute.ts +++ b/src/commands/Moderation/unmute.ts @@ -33,7 +33,7 @@ export const execute = async ( ) .setColor(0x5865f2), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -44,7 +44,7 @@ export const execute = async ( .setDescription("❌ You don't have permission to unmute members.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -59,7 +59,7 @@ export const execute = async ( .setDescription("❌ I don't have permission to unmute members.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -79,7 +79,7 @@ export const execute = async ( .setDescription("❌ User ID not found.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } } @@ -92,7 +92,7 @@ export const execute = async ( .setDescription("❌ Please mention a user or provide their ID.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -103,7 +103,7 @@ export const execute = async ( .setDescription("❌ This user is not muted.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); return; } @@ -137,6 +137,6 @@ export const execute = async ( .setDescription("❌ Failed to unmute the user.") .setColor(0xff0000), ], - }); + }).then(msg => setTimeout(() => msg.delete(), 5000)); } }; From a01e27be9a7b96c04b4ab44e18722ccfd88e1a74 Mon Sep 17 00:00:00 2001 From: UltimatePlayer97 Date: Mon, 17 Feb 2025 10:51:37 +1100 Subject: [PATCH 6/6] chage systeminfo to systeminformtion --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9cda29b..35ef2ca 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "ffmpeg-static": "^5.2.0", "play-dl": "^1.9.7", "prism-media": "^1.3.5", - "systeminfo": "^0.0.1", + "systeminformation": "5.25.11", "ytdl-core": "^4.11.5" }, "scripts": {