Some text in the Modal..

Some text in the Modal..

How To Make A Simple Discord Bot With Discord.Js | BJ Creations

Type something and hit enter

ads here
On
advertise here
Before we start you need to create a JavaScript file called "Index.js":

Related image

Download these two important software and install "npm" on your pc after that create the bot folder and open that with the editor visual studio code and create a file named as "Index.js".
  • Download Node.Js 
  • Download Visual Code


Let's create a ping and pong command xD. Use the simple code:
const Discord = require('discord.js');const bot = new Discord.Client();
const token = process.env.arcadia;
const PREFIX = '--';
bot.on('ready', () =>{    console.log('my bot is ready');    bot.user.setActivity('--help | WePlay');})
bot.on('guildMemberAdd', member =>{    const channel = member.guild.channels.find(channel => channel.name === "welcome")    if (!channel) return;
    channel.send(`welcome to our server, ${member}, Thanks :wink:`)});
bot.on('message', message=>{        let args = message.content.substring(PREFIX.length).split(' ');
    switch(args[0]){        case 'ping':            message.channel.send('pong ');            break;


After that you to write the bot.login .process if want to upload your bot to GitHub then use the code as given below:

 }    })bot.login(process.env.token);


Download the Visual Studio Code for coding and also you need to download the latest version of node.Js simple go their official website and download node.js from there.


1 Comment:

avatar

Download the index.js from GitHub

Click to comment