aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuca Matei Pintilie <lucafulger@gmail.com>2022-08-16 15:18:27 +0000
committerLuca Matei Pintilie <lucafulger@gmail.com>2022-08-16 15:18:27 +0000
commit1f7c60f07dea75c4a21e813fce5e7bb1fe706f6f (patch)
treea1ca2f11a177362b6cbfa6cc3e788ce4cd7ccce4 /src
parent38eb35b82b7889b045179b1baf5582a938b3e2ce (diff)
downloadspeedrunbot-slash-1f7c60f07dea75c4a21e813fce5e7bb1fe706f6f.tar
speedrunbot-slash-1f7c60f07dea75c4a21e813fce5e7bb1fe706f6f.tar.gz
speedrunbot-slash-1f7c60f07dea75c4a21e813fce5e7bb1fe706f6f.tar.bz2
speedrunbot-slash-1f7c60f07dea75c4a21e813fce5e7bb1fe706f6f.tar.lz
speedrunbot-slash-1f7c60f07dea75c4a21e813fce5e7bb1fe706f6f.tar.xz
speedrunbot-slash-1f7c60f07dea75c4a21e813fce5e7bb1fe706f6f.tar.zst
speedrunbot-slash-1f7c60f07dea75c4a21e813fce5e7bb1fe706f6f.zip
Don't cancel command if the wrong person pressed cancel
Diffstat (limited to '')
-rw-r--r--src/srcom/slash_commands.tsx20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/srcom/slash_commands.tsx b/src/srcom/slash_commands.tsx
index 3586a81..4aabda3 100644
--- a/src/srcom/slash_commands.tsx
+++ b/src/srcom/slash_commands.tsx
@@ -430,23 +430,17 @@ const runningTasks = new Map<
>();
export class SpeedrunCom extends ApplicationCommandsModule {
- static async handleCancelButton(i: MessageComponentInteraction) {
+ static async handleCancelButton(i: MessageComponentInteraction): Promise<void> {
const task = runningTasks.get(i.customID)!;
if (!task) {
- try {
- await i.respond({
- content: "Sorry, but I couldn't find the running task to cancel.",
- ephemeral: true,
- });
- } catch {
- await i.editResponse({
- content: "Sorry, but I couldn't find the running task to cancel.",
- ephemeral: true,
- });
- }
+ await i.respond({
+ content: "Sorry, but I couldn't find the running task to cancel.",
+ ephemeral: true,
+ });
+ return;
}
if (task.user !== i.user.id) {
- i.send({
+ await i.send({
content: "You are not allowed to cancel this.",
ephemeral: true,
});