discord-bot/cmd/register.ts
2025-07-31 19:39:56 +01:00

21 lines
No EOL
820 B
TypeScript

import { ChatInputCommandInteraction, MessageFlags, 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", flags: MessageFlags.Ephemeral });
return;
}
await interaction.reply({
content: `visit [this link](${process.env.API + "/auth/login"}) to create your stereo account`,
flags: MessageFlags.Ephemeral
})
}
export default [data, execute] as const;