diff --git a/commands.json b/commands.json index d24e475..b5e4726 100644 --- a/commands.json +++ b/commands.json @@ -68,5 +68,9 @@ "name": "list", "description": "List all active accounts", "type": 1 + }, + { + "name": "cancel", + "description": "Cancel verification and account number creation if you have one in-progress" } ] \ No newline at end of file diff --git a/index.js b/index.js index 4a91dda..e0a6130 100644 --- a/index.js +++ b/index.js @@ -396,6 +396,27 @@ client.on("interactionCreate", async (interaction) => { } }); break; + case "cancel": // Cancel an unverified account + // Check if the user has an unverified account, if they do, delete it + db.get("SELECT * FROM accounts WHERE discord_id = ? AND verified = 0", interaction.user.id, (err, row) => { + if (err) { + console.error(err); + } else if (row) { + db.run("DELETE FROM accounts WHERE discord_id = ? AND verified = 0", interaction.user.id, (err) => { + if (err) { + console.error(err); + } else { + interaction.reply({ + content: "Account creation cancelled.", + ephemeral: true + }); + } + }); + } else { + interaction.reply({ content: "You don't have an unverified account.", ephemeral: true }); + } + }); + break; } });