aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-05-25 17:06:02 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-05-25 17:06:02 -0400
commit210678c5f4391b4f5959bd2664d38a0222cbdbe3 (patch)
tree6123ab4c74f3aef1aefee5583ed9a7d0fcc8bc79
parent59ea06a2f010ad7503e4f7b7a1894485d37a416e (diff)
downloadtanzanite-210678c5f4391b4f5959bd2664d38a0222cbdbe3.tar.gz
tanzanite-210678c5f4391b4f5959bd2664d38a0222cbdbe3.tar.bz2
tanzanite-210678c5f4391b4f5959bd2664d38a0222cbdbe3.zip
feat: add command locking
-rw-r--r--src/commands/admin/channelPermissions.ts3
-rw-r--r--src/commands/admin/roleAll.ts3
-rw-r--r--src/commands/moderation/block.ts3
-rw-r--r--src/commands/moderation/lockdown.ts3
-rw-r--r--src/commands/moderation/massBan.ts3
-rw-r--r--src/listeners/commands/commandLocked.ts17
6 files changed, 27 insertions, 5 deletions
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts
index c06b5fa..dac7117 100644
--- a/src/commands/admin/channelPermissions.ts
+++ b/src/commands/admin/channelPermissions.ts
@@ -51,7 +51,8 @@ export default class ChannelPermissionsCommand extends BushCommand {
clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageChannels]),
userPermissions: [PermissionFlagsBits.Administrator],
channel: 'guild',
- slash: true
+ slash: true,
+ lock: 'guild'
});
}
diff --git a/src/commands/admin/roleAll.ts b/src/commands/admin/roleAll.ts
index cc5e7b4..fdf153a 100644
--- a/src/commands/admin/roleAll.ts
+++ b/src/commands/admin/roleAll.ts
@@ -33,7 +33,8 @@ export default class RoleAllCommand extends BushCommand {
clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageRoles]),
userPermissions: [PermissionFlagsBits.Administrator],
typing: true,
- slash: true
+ slash: true,
+ lock: 'guild'
});
}
diff --git a/src/commands/moderation/block.ts b/src/commands/moderation/block.ts
index e6f7849..554ef2b 100644
--- a/src/commands/moderation/block.ts
+++ b/src/commands/moderation/block.ts
@@ -52,7 +52,8 @@ export default class BlockCommand extends BushCommand {
slash: true,
channel: 'guild',
clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageChannels]),
- userPermissions: (m) => util.userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages])
+ userPermissions: (m) => util.userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages]),
+ lock: 'channel'
});
}
diff --git a/src/commands/moderation/lockdown.ts b/src/commands/moderation/lockdown.ts
index 3e4f05b..36f3240 100644
--- a/src/commands/moderation/lockdown.ts
+++ b/src/commands/moderation/lockdown.ts
@@ -59,7 +59,8 @@ export default class LockdownCommand extends BushCommand {
slash: true,
channel: 'guild',
clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.ManageChannels]),
- userPermissions: [PermissionFlagsBits.ManageChannels]
+ userPermissions: [PermissionFlagsBits.ManageChannels],
+ lock: 'channel'
});
}
diff --git a/src/commands/moderation/massBan.ts b/src/commands/moderation/massBan.ts
index faea94b..568b6be 100644
--- a/src/commands/moderation/massBan.ts
+++ b/src/commands/moderation/massBan.ts
@@ -55,7 +55,8 @@ export default class MassBanCommand extends BushCommand {
slash: true,
channel: 'guild',
clientPermissions: (m) => util.clientSendAndPermCheck(m),
- userPermissions: [PermissionFlagsBits.BanMembers]
+ userPermissions: [PermissionFlagsBits.BanMembers],
+ lock: 'user'
});
}
diff --git a/src/listeners/commands/commandLocked.ts b/src/listeners/commands/commandLocked.ts
new file mode 100644
index 0000000..285eb50
--- /dev/null
+++ b/src/listeners/commands/commandLocked.ts
@@ -0,0 +1,17 @@
+import { BushListener, type BushCommandHandlerEvents } from '#lib';
+
+export default class CommandLockedListener extends BushListener {
+ public constructor() {
+ super('commandLocked', {
+ emitter: 'commandHandler',
+ event: 'commandLocked',
+ category: 'commands'
+ });
+ }
+
+ public override async exec(...[message, command]: BushCommandHandlerEvents['commandLocked']) {
+ return message.util.reply(
+ `${util.emojis.error} You cannot use the ${util.format.input(command.id)} command because it is already in use.`
+ );
+ }
+}