feat: Add slash command ephemeral
This commit is contained in:
parent
e0e82d44f8
commit
0c334c6bd1
3 changed files with 14 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "muffinbot",
|
"name": "muffinbot",
|
||||||
"version": "4.0.0-pudding.e241001a",
|
"version": "4.0.0-pudding.e241001b",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -49,6 +49,8 @@ class DeleteLearnCommand extends Command {
|
||||||
user = ctx.user
|
user = ctx.user
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ephemeral =
|
||||||
|
ctx instanceof ChatInputCommandInteraction ? { ephemeral: true } : null
|
||||||
const CUSTOM_ID = 'maa$deleteLearn'
|
const CUSTOM_ID = 'maa$deleteLearn'
|
||||||
const options: SelectMenuComponentOptionData[] = []
|
const options: SelectMenuComponentOptionData[] = []
|
||||||
const deleteDataList: string[] = []
|
const deleteDataList: string[] = []
|
||||||
|
@ -66,7 +68,10 @@ class DeleteLearnCommand extends Command {
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!deleteDatas) {
|
if (!deleteDatas) {
|
||||||
return await ctx.reply('해당하는 걸 찾ㅈ을 수 없어요.')
|
return await ctx.reply({
|
||||||
|
...ephemeral,
|
||||||
|
content: '해당하는 걸 찾ㅈ을 수 없어요.',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 1; i <= deleteDatas.length; i++) {
|
for (let i = 1; i <= deleteDatas.length; i++) {
|
||||||
|
@ -79,6 +84,7 @@ class DeleteLearnCommand extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
await ctx.reply({
|
await ctx.reply({
|
||||||
|
...ephemeral,
|
||||||
embeds: [
|
embeds: [
|
||||||
{
|
{
|
||||||
title: '삭제',
|
title: '삭제',
|
||||||
|
|
|
@ -19,6 +19,8 @@ class ListCommand extends Command {
|
||||||
|
|
||||||
private async _run(ctx: Message | ChatInputCommandInteraction) {
|
private async _run(ctx: Message | ChatInputCommandInteraction) {
|
||||||
const user = ctx instanceof Message ? ctx.author : ctx.user
|
const user = ctx instanceof Message ? ctx.author : ctx.user
|
||||||
|
const ephemeral =
|
||||||
|
ctx instanceof ChatInputCommandInteraction ? { ephemeral: true } : null
|
||||||
const db = this.container.database
|
const db = this.container.database
|
||||||
const data = await db.learn.findMany({
|
const data = await db.learn.findMany({
|
||||||
where: {
|
where: {
|
||||||
|
@ -28,7 +30,10 @@ class ListCommand extends Command {
|
||||||
const list: string[] = []
|
const list: string[] = []
|
||||||
|
|
||||||
if (!data[0]) {
|
if (!data[0]) {
|
||||||
return await ctx.reply('당신ㄴ은 단어를 가르쳐준 기억이 없ㅅ는데요.')
|
return await ctx.reply({
|
||||||
|
...ephemeral,
|
||||||
|
content: '당신ㄴ은 단어를 가르쳐준 기억이 없ㅅ는데요.',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const listData of data) {
|
for (const listData of data) {
|
||||||
|
|
Loading…
Reference in a new issue