From 0c334c6bd1690faf4a5547b7114e13c459b74130 Mon Sep 17 00:00:00 2001 From: Siwoo Jeon Date: Tue, 1 Oct 2024 15:17:25 +0900 Subject: [PATCH] feat: Add slash command ephemeral --- package.json | 2 +- src/Commands/deleteLearn.ts | 8 +++++++- src/Commands/list.ts | 7 ++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 772b0f8..e0f2839 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "muffinbot", - "version": "4.0.0-pudding.e241001a", + "version": "4.0.0-pudding.e241001b", "main": "dist/index.js", "private": true, "dependencies": { diff --git a/src/Commands/deleteLearn.ts b/src/Commands/deleteLearn.ts index 6d893ad..ccc0ac7 100644 --- a/src/Commands/deleteLearn.ts +++ b/src/Commands/deleteLearn.ts @@ -49,6 +49,8 @@ class DeleteLearnCommand extends Command { user = ctx.user } + const ephemeral = + ctx instanceof ChatInputCommandInteraction ? { ephemeral: true } : null const CUSTOM_ID = 'maa$deleteLearn' const options: SelectMenuComponentOptionData[] = [] const deleteDataList: string[] = [] @@ -66,7 +68,10 @@ class DeleteLearnCommand extends Command { }) if (!deleteDatas) { - return await ctx.reply('해당하는 걸 찾ㅈ을 수 없어요.') + return await ctx.reply({ + ...ephemeral, + content: '해당하는 걸 찾ㅈ을 수 없어요.', + }) } for (let i = 1; i <= deleteDatas.length; i++) { @@ -79,6 +84,7 @@ class DeleteLearnCommand extends Command { } await ctx.reply({ + ...ephemeral, embeds: [ { title: '삭제', diff --git a/src/Commands/list.ts b/src/Commands/list.ts index 6f0eaa3..f9ddf25 100644 --- a/src/Commands/list.ts +++ b/src/Commands/list.ts @@ -19,6 +19,8 @@ class ListCommand extends Command { private async _run(ctx: Message | ChatInputCommandInteraction) { const user = ctx instanceof Message ? ctx.author : ctx.user + const ephemeral = + ctx instanceof ChatInputCommandInteraction ? { ephemeral: true } : null const db = this.container.database const data = await db.learn.findMany({ where: { @@ -28,7 +30,10 @@ class ListCommand extends Command { const list: string[] = [] if (!data[0]) { - return await ctx.reply('당신ㄴ은 단어를 가르쳐준 기억이 없ㅅ는데요.') + return await ctx.reply({ + ...ephemeral, + content: '당신ㄴ은 단어를 가르쳐준 기억이 없ㅅ는데요.', + }) } for (const listData of data) {