refactor: reorganize project structure and improve user command handling

This commit is contained in:
grngxd 2025-07-31 19:25:31 +01:00
parent 5cfcb3ba0c
commit 49d6b51de6
7 changed files with 64 additions and 26 deletions

18
cmd/register.ts Normal file
View 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;