Create Discord Bot in Android using discord.js 1

Create Discord Bot in Android using discord.js

Hey guys, if you dont have pc and you want to create a good looking discord bot without using any bot creating website then you should real this whole document. or a post.

REQUIRED APP – If you want to create bot then you will sure needed a good node.js editor and for that i have a good one whoose name is Astro – node.js/javascript/terminal/code editor , Go and download this amazing editor or IDE.

LANGUAGE – We gonna use node.js and it allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot’s code significantly tidier and easier to comprehend.

BOT – We need a bot so we can code or develop it , If you do not know how to create bot then i suggest checking these documents will be good for you – Bot setup

DEVELOPING BOT – So we are all done with setup, now we gonna do real shit. open the editor and follow steps which are given below

1 – Click on this start button where arrow is pointing, Then you have to choose the folder where you want to save bot file, either you can create an folder of your bot.

Create Discord Bot in Android using discord.js 2

2 – I recommend you to create a different folder to save a file of bot, so for that you need to click on New button.

Create Discord Bot in Android using discord.js 3

3 -Now type your bot name or folder name and click on create

Create Discord Bot in Android using discord.js 4

4 – Find that folder and open it

Create Discord Bot in Android using discord.js 5

5 – After opening it click on select icon.

Create Discord Bot in Android using discord.js 6

6 – After you do all the stuff that is written above, you will see this. Click on path that you see , name like – /storage/emulated/0/Ctk-bot, click on create file icon where arrow is pointing in image.

Create Discord Bot in Android using discord.js 7

7 – Name the file as i named it index.js, you can name it anything you want, But you should not forget to add .js in last as it is java script file.

Create Discord Bot in Android using discord.js 8

8 – After you name the file you will see things like this, to edit the file click on path that is – /storage/emulated/0/Ctk-bot in my case , then you will see file that you created.

Create Discord Bot in Android using discord.js 9

9 – Now click on file that you created, As you can see there are four option at top which are Astro, MANAGE, EDITOR, BROWSER. Click on EDITOR option to edit index.js

Create Discord Bot in Android using discord.js 10

10 – As you can see we are now at editing mode, So we will start developing bot from now on

Create Discord Bot in Android using discord.js 11
// require the discord.js module
const Discord = require('discord.js');

// create a new Discord client
const client = new Discord.Client();
const prefix = "c!"; //Prefix of the bot
// when the client is ready, run this code
// this event will only trigger one time after logging in
client.once('ready', () => {
	console.log('Ready!');
});

client.on('message', message => { //Listening for messages
	if(message.content === `${prefix}ping`) {
      	// send back "ping rates" to the channel the message was sent in
      message.channel.send(`Pong - ${clinet.ws.ping}`)
    }
});

// login to Discord with your app's token
client.login('your-token-goes-here');

Try to understand above codes and do not forget to read comments, Paste your BOT TOKEN in last in client.login(“TOKEN HERE”)

Now we need to installed module that we just used which is discord.js and for that you need to go to terminal, Slide it up black bar which is shown below in image in your app to get terminal window.

Create Discord Bot in Android using discord.js 12

Type npm install discord.js in the terminla, after you do this , terminal will start installing discord.js module. After that type node index.js , It will start running your bot, in my case my file name was index.js if you have different file then you should type that file name.

Bot is online 🙂

Create Discord Bot in Android using discord.js 13

And its working fine

Create Discord Bot in Android using discord.js 14

Table of Contents

HOSTING

We gonna use Heroku for hosting, as it gives free hosting hours , For that you need to upload your bot codes in github with package.json file. if you dont know how to do that i will tell you, post will be continue from here – Hosting Discord bot in Android.

Leave a Reply

Your email address will not be published. Required fields are marked *