import { ChatInputCommandInteraction, MessageFlags, SlashCommandSubcommandBuilder } from "discord.js"; import { defineCommand } from "../command"; import { playVoice } from "../tts"; import { getUserProfile } from "../db"; export default defineCommand( new SlashCommandSubcommandBuilder() .setName("말") .setDescription("구구가가") .addStringOption(option => option .setName("content") .setDescription("예주가 말해준데요") .setRequired(true) ), async (interaction: ChatInputCommandInteraction): Promise => { await interaction.deferReply({ flags: [MessageFlags.Ephemeral] }); if (interaction.guild == null) return await interaction.editReply("올바르지 않은 서버에요"); try { await playVoice( interaction.guild, await getUserProfile(interaction.user.id), interaction.options.getString("content") as string ); await interaction.editReply("말했어요!"); } catch { await interaction.editReply("오늘따라 말이 꼬이네요 ㅜ.ㅜ"); } } )