35 lines
1 KiB
TypeScript
35 lines
1 KiB
TypeScript
import {
|
|
ChatInputCommandInteraction,
|
|
MessageFlags,
|
|
SlashCommandBuilder,
|
|
} from "discord.js";
|
|
import { defineCommand } from "../command.js";
|
|
import { getGuildProfile } from "../db.js";
|
|
|
|
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: any) => `<#${channel}>`).join("\n") ||
|
|
"아무 채널도 읽지 않아요!",
|
|
);
|
|
} catch {
|
|
await interaction.editReply("서버 프로필을 가져오는데 문제가 생겼어요");
|
|
}
|
|
},
|
|
);
|