1//the first thing you need to do is make sure you have Node v16.6.0 or higher
2//you can chack it by running this command: node -v
3//install dicord.js first use this command: npm install discord.js
4//this must be done in the folder you want to make your bot
5//after this can you make a file call it whatever you want.
6//exable index.js
7const Discord = require('discord.js');
8const client = new Discord.Client({ intents: ['GUILDS', 'GUILD_MESSAGES']});
9
10client.on('ready', () => {
11 console.log(`Logged in as ${client.user.tag}`);
12})
13
14//message no longer works so use messageCreate
15client.on('messageCreate', msg => {
16 console.log(msg);
17 if(msg.content === "ping"){
18 msg.reply("pong!!!");
19 }
20})
21
22client.login("your-bot-token");
1//first you must install dicord.js by running the command: npm install discord.js
2//once u do that copy and paste this into your main file
3const Discord = require('discord.js');
4const client = new Discord.Client();
5
6client.on('ready', () =>{
7 client.user.setStatus('your status')
8 console.log('Connected!')
9})
10//rest of your code
11
12//always remember to never share your token with anyone
13client.login('your-token-here')
1//Here is how to get your bot up and running!
2//1: Go to https://nodejs.org/ and download node.js.
3//2: Open your code editor
4//3: Make a new folder.
5//4: Name it DiscordBot - This can be whatever you want.
6//5: Make a text document and name it main.js
7//6: Put the text document in your folder.
8//7: Open your folder in your text editor.
9//8: Go to main.js
10//9: Press [Windows] + [R].
11//10: Type: "cmd" in the text box.
12//11: In the command prompt, type: "npm install discord.js"
13//12: Inside main.js, insert this script:
14
15const Discord = require('discord.js')
16const client = new Discord.Client()
17
18client.on('ready', () =>{
19 client.user.setStatus('Listening for: !help')
20 console.log('Bot is ready to be used!')
21}
22
1const Discord = require('discord.js') //this says that its using discord.js and classifing it as a bot
2const bot = new Discord.Client();
3
4const token = 'put your bots token here!';
5//link to the dev portal to make your own discord bot here: https://discord.com/developers/applications
1/* Okay So
21. You need to know the basics of Discord.js (learn on yt)
32. Go to dev portal (https://discord.com/developers/applications) Make a bot
4 Invite to your server
53. Start coding the bot in Discord.js
64. Host the bot somewhere like repl.it
75. You're done / Implement the bot
8*/