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

28 lines
No EOL
1.1 KiB
TypeScript

import { ChatInputCommandInteraction, MessageFlags, SlashCommandBuilder } from "discord.js";
import { defineCommand } from "../command";
import { getGuildProfile } from "../db";
export default defineCommand(
new SlashCommandBuilder()
.setName("읽는채널")
.setDescription("예주가 읽어주는 채널들을 말해줘요"),
async (interaction: ChatInputCommandInteraction): Promise<any> => {
await interaction.deferReply({
flags: [MessageFlags.Ephemeral]
});
const guildId = interaction.guildId;
if (guildId == null)
return await interaction.editReply("알수없는 서버에요!");
try {
const guildProfile = await getGuildProfile(guildId);
const readChannel = guildProfile.readChannel;
await interaction.editReply(readChannel.map(channel => `<#${channel}>`).join("\n") || "아무 채널도 읽지 않아요!");
} catch {
await interaction.editReply("서버 프로필을 가져오는데 문제가 생겼어요");
}
}
)