Node.js (discord.js)
Dependencies are installed from package.json with your package manager (npm, pnpm or yarn depending on your lockfile). The start script is used when present.
package.json
{
"name": "my-bot",
"main": "index.js",
"scripts": { "start": "node index.js" },
"dependencies": {
"discord.js": "^14.19.3",
"dotenv": "^16.5.0"
}
}index.js
require('dotenv').config();
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once('ready', (c) => console.log(`Logged in as ${c.user.tag}`));
client.login(process.env.TOKEN);💡
TypeScript: compile before uploading (
dist/), or add a start script that runs your compiled file.