discord-bot/cmd/register.ts

18 lines
No EOL
717 B
TypeScript

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;