yaejunyang/packages/bot/commands/setNya.ts

21 lines
648 B
TypeScript

import {
ChatInputCommandInteraction,
MessageFlags,
SlashCommandBuilder,
} from "discord.js";
import { defineCommand } from "../command";
import { getUserProfile, setUserNya } from "../db";
export default defineCommand(
new SlashCommandBuilder().setName("냥").setDescription("???"),
async (interaction: ChatInputCommandInteraction): Promise<any> => {
await interaction.deferReply({
flags: [MessageFlags.Ephemeral],
});
const profile = await getUserProfile(interaction.user.id);
await setUserNya(interaction.user.id, !profile.nya);
await interaction.editReply(profile.nya ? "냐앙..." : "냐앙!!");
},
);