refactor: reorganize project structure and improve user command handling
This commit is contained in:
parent
5cfcb3ba0c
commit
49d6b51de6
7 changed files with 64 additions and 26 deletions
18
cmd/register.ts
Normal file
18
cmd/register.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import { db } from "../db/db";
|
||||
|
||||
export const data = new SlashCommandBuilder()
|
||||
.setName("register")
|
||||
.setDescription("create your stereo account");
|
||||
|
||||
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||
const existingUser = await db.get<{ id: string }>`SELECT id FROM users WHERE id = ${interaction.user.id}`;
|
||||
if (existingUser) {
|
||||
await interaction.reply({ content: "You already have a stereo account.", ephemeral: true });
|
||||
return;
|
||||
}
|
||||
|
||||
await interaction.reply({ content: "Your stereo account has been created!", ephemeral: true });
|
||||
}
|
||||
|
||||
export default [data, execute] as const;
|
Loading…
Add table
Add a link
Reference in a new issue