A easy way for making bots using Discord.js/Node.js

Overview

Discord.js-Bot-Template

This is a very simple template for making bots using Discord.js/Node.js

made-with-javascript Hits

Tutorial:

To begin, Install Node.js here.

After Node.Js is succesfully installed run the following command in the folder where the files for your discord bot will be and fill in the information:

 npm init 

Create an app in the Discord Developer Portal and on the left go to Bot > Build-A-Bot to set up the bot

In the main.js type the following:

const Discord = require('discord.js');
const bot = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] });
const token = '';
const PREFIX = ''; 

bot.on('ready', () => {
    console.log("I am online!")
})
bot.on("message", msg => {
    if (msg.content === PREFIX + "ping") {
      msg.reply("pong");
    }
})

bot.login(token)

Edit the const token = '' to your bot's token you've been given. DO NOT SHARE THIS TOKEN WITH ANYONE!

Optional Edit the const PREFIX = '' if you want to use a prefix for messages, For example =ping would be const PREFIX = '='

To create an invite link for your bot. Go to the Discord Developer Portal and on the left go to OAuth2 > URL Generator and choose the option Bot under Scopes. You can edit the bots permissions how you like.

To make the bot temporarily online, type the following in the command prompt in the folder with the files:

 node . 

You should get a response like "I am online!". in the Command Prompt.

To test your bot, Invite the bot to a server and type ping in the chat. When you get a reply from the bot with pong it means that the bot is working! You can now edit the code and add new features to it.

To learn more about discord.js Click the link to go to the discord.js documentation.


Help/Support

I'm actually not intending to help everyone with any problems with the tutorial. if there's a bug i'll recommend searching for discord.js related help. You can always go to the discord.js discord server to ask help. (link is here down below)


Links

You might also like...

Katsushika: A REVERSED VERSION OF ASUNA & CHITOGE BOTS

Katsushika: A REVERSED VERSION OF ASUNA & CHITOGE BOTS

Katsushika: A REVERSED VERSION OF ASUNA & CHITOGE BOTS A Fully Modular and Efficient Bot Button : If you are deploying normally Button : If you are de

Aug 23, 2022

Easy and simple twitch bot in node.js.. very very easy..

Easy and simple twitch bot in node.js.. very very easy..

How It Works identity: { username: 'YOUR BOTS USERNAME', -- This is where you place the username that you gave the bot account password: '

Dec 18, 2021

This bot is a cool Discord bot made in discord.js using Node.JS

This bot is a cool Discord bot made in discord.js using Node.JS

Anti-Crosspost Discord Bot This bot is a cool Discord bot made in discord.js using Node.JS. It detects when a user cross-posts a message in multiple c

May 31, 2022

Easy and automatic updating way

Changes: ENTER Intents for client! const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MEMBE

Jul 16, 2022

An easy way for users to appeal from a server ban. Hosted with Cloudflare workers.

An easy way for users to appeal from a server ban. Hosted with Cloudflare workers.

Discord Ban Appeal Make it possible for users to appeal their bans online With a simple configuration to make your form unqiue to your server and with

Aug 10, 2022

A simple & easy2use API for obtaining information about a discord user, discord bot or discord guild and their use for some purpose on websites!

discord-web-api A simple & easy2use API for obtaining information about a discord user, discord bot or discord guild and their use for some purpose on

Jun 28, 2022

Discord Neura - a Discord bot framework built on discord.js

Discord Neura Description Discord Neura is a Discord bot framework built on discord.js. Features Command Handler, Arguments, Preconditions and Listene

Mar 23, 2022

Gitlift Discord Bot is a discord bot which is listening Discord Messages to reply with user gitlift profile and total contributions.

Gitlift Discord Bot is a discord bot which is listening Discord Messages to reply with user gitlift profile and total contributions.

Remoklify - Gitlift Discord Bot Gitlift Discord Bot is a discord bot which is listening Discord Messages to reply with user gitlift profile and total

Mar 20, 2022

About Discord bot draft that does not contain ready-made commands, compatible with discord.js v14. Create your own discord bot with this command handler.

discordJS-V14 About Discord bot draft that does not contain ready-made commands, compatible with discord.js v14. Create your own discord bot with this

Dec 28, 2022
Owner
Prosperity
Prosperity
A utility package for making discord-bot commands much easier to write with discord.js.

Cordcommand About A utility package for making discord-bot commands much easier to write with discord.js. Usage Example // initiate discord.js client

Reinforz 15 Sep 15, 2022
A utility package for making discord-bot commands much easier to write with discord.js.

Cordmand About A utility package for making discord-bot commands much easier to write with discord.js. Usage Example Install this package: npm i @rein

Reinforz 15 Sep 28, 2022
A utility package for Discord Bots!

Nuggies A utility package for Discord Bots! For errors and questions you can join our support server Installation Table of content: - installation - d

Nuggies 43 Dec 17, 2022
Tutoriel en francais sur le framework Sheweny, création de bots discord pour les débutants

Tutoriel Sheweny ✨ Sheweny est un framework pour créer des bots sur discord avec discord.js. Bienvenue dans le repo du tutoriel sur le framework Shewe

Sheweny 5 Jul 29, 2022
a full functional discord bot to send MooMoo.io bots

MooMooBot a full functional discord bot to send moomoo.io bots commands !send <server> <name> ex: !send 8:0:0 Nuro !token (generates a token to test

null 1 Jan 7, 2022
✨ the template for all my discord bots!

my discord bot template ⚠️ if you are using this template: please credit me, be it in a command, or in the readme file, i'm not picky. so essentially

null 11 Oct 22, 2022
A discord bot made using discord.js and discord-player

Musx A custom discord bot that can play music in your server ?? Add the bot to your server If you are looking for a music bot for your Discord server

Shashwat Singh 4 Mar 28, 2022
As you can tell from the name of the Bots+, it looks like a Members+ bot

Info As you can tell from the name of the Bots+, it looks like a Members+ bot. Usage First step: "!help" You must set your language with this command.

Custy 4 Feb 21, 2022
When new tokens gets listed on a DEX, bots are able to detect this and be one of the first to buy the token for a low price. This is an example of such bot.

Listing Sniping Bot When a new token gets listed on a DEX, bots are able to detect the PairCreated event emitted from the DEX's factory contract. This

MouseLess.eth 15 Dec 21, 2022
Whatscode.js is a package to create Whatsapp bots easily and quickly

whatscode.js is a package to create Whatsapp bots easily and quickly, even coding experience is not needed...

JstnLT 21 Dec 30, 2022