aboutsummaryrefslogtreecommitdiff
path: root/src/srcom/slash_commands.tsx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/srcom/slash_commands.tsx52
1 files changed, 28 insertions, 24 deletions
diff --git a/src/srcom/slash_commands.tsx b/src/srcom/slash_commands.tsx
index 69d1878..15698d5 100644
--- a/src/srcom/slash_commands.tsx
+++ b/src/srcom/slash_commands.tsx
@@ -437,31 +437,35 @@ export class SpeedrunCom extends ApplicationCommandsModule {
i: MessageComponentInteraction,
): Promise<void> {
const task = runningTasks.get(i.customID)!;
- if (!task) {
- await i.send({
- content: "Sorry, but I couldn't find the running task to cancel.",
- ephemeral: true,
- });
- return;
- }
- if (task.user !== i.user.id) {
- await i.send({
- content: "You are not allowed to cancel this.",
- ephemeral: true,
- });
- return;
- }
- task.signal.abort();
try {
- await i.respond({
- content: "Canceled",
- ephemeral: true,
- });
- } catch {
- await i.editResponse({
- content: "Canceled",
- ephemeral: true,
- });
+ if (!task) {
+ await i.send({
+ content: "Sorry, but I couldn't find the running task to cancel.",
+ ephemeral: true,
+ });
+ return;
+ }
+ if (task.user !== i.user.id) {
+ await i.send({
+ content: "You are not allowed to cancel this.",
+ ephemeral: true,
+ });
+ return;
+ }
+ task.signal.abort();
+ try {
+ await i.respond({
+ content: "Canceled",
+ ephemeral: true,
+ });
+ } catch {
+ await i.editResponse({
+ content: "Canceled",
+ ephemeral: true,
+ });
+ }
+ } catch (err) {
+ console.error(err);
}
runningTasks.delete(i.customID);
}