-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from boaz-baekjoon/Feat/34-slash-command
Feat: Slash Command
- Loading branch information
Showing
19 changed files
with
287 additions
and
374 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {logger} from "../logger.js"; | ||
import {ChatInputCommandInteraction, SlashCommandBuilder} from "discord.js"; | ||
import {ModelUtil} from "../util/modelUtil.js"; | ||
import {categoryList} from "../embedMessage/categoryMessage.js"; | ||
|
||
export default { | ||
data: new SlashCommandBuilder() | ||
.setName('categorylist') | ||
.setDescription('카테고리 목록을 받습니다.'), | ||
|
||
async execute(interaction: ChatInputCommandInteraction) { | ||
try { | ||
await interaction.reply({embeds: [categoryList]}); | ||
} catch (error) { | ||
logger.error(error) | ||
await interaction.reply("알 수 없는 오류가 발생했습니다.") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {ChatInputCommandInteraction, SlashCommandBuilder} from "discord.js"; | ||
import {MongoUtil} from "../util/mongoUtil.js"; | ||
import {logger} from "../logger.js"; | ||
|
||
export default { | ||
data: new SlashCommandBuilder() | ||
.setName('deactivate') | ||
.setDescription('일일 문제 알림 수신을 비활성화 합니다.'), | ||
async execute(interaction: ChatInputCommandInteraction) { | ||
try { | ||
const user = await MongoUtil.findUserWithDiscordId(interaction.user.id); | ||
if (!user) { | ||
await interaction.reply("등록되지 않은 유저입니다. /register를 통해 등록해주세요.") | ||
return; | ||
} | ||
|
||
const response = await MongoUtil.deleteTime(interaction.user.id); | ||
if (response) { | ||
await interaction.reply("정상적으로 중단되었습니다.") | ||
} | ||
return; | ||
} catch (error: any) { | ||
await interaction.reply("알 수 없는 오류가 발생했습니다.") | ||
logger.error(error.message) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import {embedWelcome} from '../embedMessage/guideMessage.js'; | ||
import {Message} from "discord.js"; | ||
import {ChatInputCommandInteraction, Message, SlashCommandBuilder} from "discord.js"; | ||
|
||
export async function execute(message: Message){ | ||
message.channel.send({embeds: [embedWelcome]}) | ||
} | ||
export default { | ||
data: new SlashCommandBuilder() | ||
.setName('help') | ||
.setDescription('도움말을 보여줍니다.'), | ||
async execute(interaction: ChatInputCommandInteraction){ | ||
await interaction.reply({embeds: [embedWelcome]}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {ChatInputCommandInteraction, CommandInteraction, SlashCommandBuilder} from "discord.js"; | ||
|
||
export default { | ||
data: new SlashCommandBuilder().setName('ping').setDescription('Replies with Pong!'), | ||
async execute(interaction: ChatInputCommandInteraction) { | ||
console.log('input') | ||
|
||
await interaction.reply('Pong!'); | ||
} | ||
} |
Oops, something went wrong.