ozcankrks.devbankai
TR
All posts

Building a Discord Bot with Node

Write and run your first Discord bot in a few lines with Node.js and discord.js.

To build a Discord bot with Node.js, we first need Node.js on our computer. You can download the latest version from this link: https://nodejs.org/en/ If Node.js is already installed, you can skip to the next step.

The next step is to add Discord's JavaScript module to the project. You can install it by typing the following command in your terminal.

JavaScript
npm install discord.js

After installing it, create a file named index.js and write the code below.

JavaScript
const Discord = require(‘discord.js’);const client = new Discord.Client();client.on(‘ready’, () => { console.log(`${client.user.tag} olarak giris yapildi!`); });client.on(‘message’, msg => {if (msg.content === ‘!ping’) {msg.reply(‘Pong!’);}});client.login(‘token’);

Replace "token" with the token of the bot you created on the Discord developer page. That's it, we have built a simple Discord bot. To use the bot's other features, you can find everything at https://discord.js.org/#/docs/discord.js/main/general/welcome.

Comments 0

No comments yet. Be the first.

Leave a comment

Never published.

© 2026 Özcan Karakuş · This site is built with Next.js and runs on my own server.