Update
- Add /cancel command to cancel an unverified account
This commit is contained in:
parent
bfbf63f15a
commit
266cb22ce5
|
@ -68,5 +68,9 @@
|
||||||
"name": "list",
|
"name": "list",
|
||||||
"description": "List all active accounts",
|
"description": "List all active accounts",
|
||||||
"type": 1
|
"type": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cancel",
|
||||||
|
"description": "Cancel verification and account number creation if you have one in-progress"
|
||||||
}
|
}
|
||||||
]
|
]
|
21
index.js
21
index.js
|
@ -396,6 +396,27 @@ client.on("interactionCreate", async (interaction) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
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;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue