Now using this image as my reference, I am going to explain the code.Īs you can see ☝?, there are only 30 lines of code! How amazing it that?.
Okay so we have to use 3 packages to make a discord bot, they are as follows:.
env file but we will discuss about it later in this blog.
Okay so you can see that there are two files and a folder, named as package-lock.json, package.json and node_modules respectively, they are basically of node packages and their information.
#SCREEN SHARING DISCORD BOT CODE#
There is a folder called src in which we have a main file called bot.js in which we are going to code our bot.
After that click on the link and copy it, after that paste it into a new tab and authorize it to add it to a new server.īefore explaining the code, let me explain you the folder structure ??.
Then click on the permission you have to give to the bot.
You will have a screen when many check boxes, and you have to click on the checkbox which says bot ??.
Now we have to decide what permissions does our bot need, and after deciding this, just head to OAuth2 section on the right hand side of your screen.
If you reveal it by mistake, no worries just regenerate it, but make sure you don't or else someone can take over your bot.
Now the Token is something which you have to keep a secret and not reveal anywhere or to anyone.
After clicking on bot, now click on Add Bot on the right hand side, and after this step you will have a screen like this ??.
Then on the left hand side, click on bot??.
Then you have to create a new application ☝?.
We have to go to the discord developer portal and create a new application.
What are we going to use to build this mini-project: gif happy then the bot will send a random happy gif. The way this bot will work is, if you write. Hey everyone ??, today we are going to make a discord bot ? which will send gifs according to the user in just 30 lines of code!