yaejunyang/packages/bot/commands/setVoice.ts
2026-02-09 18:31:56 +00:00

30 lines
No EOL
1.1 KiB
TypeScript

import { ChatInputCommandInteraction, MessageFlags, SlashCommandSubcommandBuilder } from "discord.js";
import { defineCommand } from "../command";
import { Voice } from "../../db/generated/prisma/enums";
import { setUserVoice } from "../db";
export default defineCommand(
new SlashCommandSubcommandBuilder()
.setName("목소리")
.setDescription("예주의 목소리를 설정해요")
.addStringOption(option =>
option
.setName("voice")
.setDescription("사용할수 있는 목소리들이에요")
.setRequired(true)
.addChoices(
{ name: "TypeCast", value: "TypeCast" },
{ name: "Papago", value: "Papago" }
)
),
async (interaction: ChatInputCommandInteraction): Promise<any> => {
await interaction.deferReply({
flags: [MessageFlags.Ephemeral]
});
const voice = interaction.options.getString("voice") as Voice;
setUserVoice(interaction.user.id, voice);
await interaction.editReply("예주의 목소리를 변경했어요!");
}
)