register cmd
This commit is contained in:
parent
49d6b51de6
commit
5fd014b677
2 changed files with 12 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
|
import { ChatInputCommandInteraction, MessageFlags, SlashCommandBuilder } from "discord.js";
|
||||||
import { db } from "../db/db";
|
import { db } from "../db/db";
|
||||||
|
|
||||||
export const data = new SlashCommandBuilder()
|
export const data = new SlashCommandBuilder()
|
||||||
|
@ -8,11 +8,14 @@ export const data = new SlashCommandBuilder()
|
||||||
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
export const execute = async (interaction: ChatInputCommandInteraction) => {
|
||||||
const existingUser = await db.get<{ id: string }>`SELECT id FROM users WHERE id = ${interaction.user.id}`;
|
const existingUser = await db.get<{ id: string }>`SELECT id FROM users WHERE id = ${interaction.user.id}`;
|
||||||
if (existingUser) {
|
if (existingUser) {
|
||||||
await interaction.reply({ content: "You already have a stereo account.", ephemeral: true });
|
await interaction.reply({ content: "you already have a stereo account", flags: MessageFlags.Ephemeral });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await interaction.reply({ content: "Your stereo account has been created!", ephemeral: true });
|
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;
|
export default [data, execute] as const;
|
5
globals.d.ts
vendored
5
globals.d.ts
vendored
|
@ -4,8 +4,11 @@ declare module "bun" {
|
||||||
TOKEN: string;
|
TOKEN: string;
|
||||||
CLIENT_ID: string;
|
CLIENT_ID: string;
|
||||||
|
|
||||||
// stereo
|
// db
|
||||||
DB_URL: string;
|
DB_URL: string;
|
||||||
DB_TYPE: "sqlite" | "postgres";
|
DB_TYPE: "sqlite" | "postgres";
|
||||||
|
|
||||||
|
// web
|
||||||
|
API: string;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue