Sorry, I am not very good at English... (DeepL Transrator)
and, source code comment out and message is Japanese.
This bot try to use Discord.js SlashCommand.
Given that "npm" and "Node.js" installed.(Install Method→※Japanese site Google translation)
・https://qiita.com/yuu_1st/items/aaa6ea92408726a0157e
・https://qiita.com/hitori_yuu/items/3b6c02fac5c610f0615a
・https://qiita.com/narikakun/items/a897104e4bd55ca1e166
npm 8.19.2
Node.js 18.14.0 (https://nodejs.org/en/)
discord.js 14.7.1(https://discord.js.org/)
①".env" open.
②"your_discord_bot_token" write your discord bot token.
③Open command prompt(Windows) or Terminal(Mac, Linux).
④Move "Discord_SlashCommandTest-main" directory.
⑤Typing command "npm install".
⑥Typing command "node src/index.js".
・Global Command
/hello→Reply "hi!".
・Guild Command
/ping→Reply "Pong!".
/auth→Reply "auth start!".
これは自分がDiscord.jsでスラッシュコマンドを試すために作ったものです。 npmやNode.jsは導入済み前提で説明をさせていただきます。(入れ方はこちらのサイトを参考にすると良いかもしれません→https://qiita.com/taiponrock/items/9001ae194571feb63a5e)
・https://qiita.com/yuu_1st/items/aaa6ea92408726a0157e
・https://qiita.com/hitori_yuu/items/3b6c02fac5c610f0615a
・https://qiita.com/narikakun/items/a897104e4bd55ca1e166
npm 8.19.2
Node.js 18.14.0 (https://nodejs.org/ja/)
discord.js 14.7.1(https://discord.js.org/)
①「.env」ファイルの中にある、「your_discord_bot_token」の部分を自分のtokenに書き換えます。
②Windowsであればコマンドプロンプト、LinuxやMacであればターミナルを開き、「src」というフォルダが存在するディレクトリーに移動し、最初に「npm install」と打ってください。次に「node src/index.js」と打つことで起動させることができます。
・グローバルコマンド
/hello→「hi!」と返信します.
・サーバーコマンド
/ping→「Pong!」と返信します。
/auth→「auth start!」と返信します。