ガイド · Discord Bot
Node.js の Bot をアップロード(discord.js)
index.js + package.json + .env → 起動。
1. Prepare
- Bot token: step 1 of Keep a Discord bot online.
- Choose Node.js 20 · 22 · 24 when ordering.
2. Three files
index.js
require('dotenv').config();
const { Client, Events, GatewayIntentBits, REST, Routes, SlashCommandBuilder } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
const commands = [new SlashCommandBuilder().setName('ping').setDescription('Response time').toJSON()];
client.once(Events.ClientReady, async (c) => {
await new REST().setToken(process.env.TOKEN).put(Routes.applicationCommands(c.user.id), { body: commands });
console.log(`Logged in: ${c.user.tag}`);
});
client.on(Events.InteractionCreate, async (i) => {
if (i.isChatInputCommand() && i.commandName === 'ping') await i.reply(`pong ${client.ws.ping}ms`);
});
client.login(process.env.TOKEN);
package.json
{
"name": "my-bot",
"main": "index.js",
"dependencies": {
"discord.js": "^14",
"dotenv": "^16"
}
}
.env
TOKEN=your_copied_token
3. Upload · start
- Service page → Open panel → Files → Upload. Do not upload
node_modules. - Console → Start.
- Console:
package.json 목록을 설치합니다.(installing packages) →봇을 시작합니다: index.js(starting bot) →Logged in: …. - Run
/pingin Discord.
4. Automatic setup
- Entry file:
maininpackage.json→index.js·main.js·bot.js·app.js(includingsrc/and.ts) → the only.jsfile →npm start. - Packages:
npm installwhenpackage.jsonchanges; missingrequireorimportpackages are also installed. - TypeScript (
.ts) runs directly. - Set manually: panel Startup → Start file · Additional packages · Packages to remove.
5. Read messages
- Developer Portal → Bot → enable Message Content Intent.
- Add
GatewayIntentBits.GuildMessages·GatewayIntentBits.MessageContenttointents.
6. GitHub (optional)
- Panel Startup → Git address (private repos: Git username · Git token).
- With an empty server directory, Settings → Reinstall Server.
- Auto update
1→git pullon each start.
すべてのガイド Discord Bot プラン お問い合わせ
提携 봇 제작 외주 이어드림 커스텀 봇 · 컴포넌트 V2 · 웹 · 프로그램 · 로고 · 배너 · UI/UX Discord で問い合わせ