One thing!
If your Roblox ranking bot can’t exile people out of the group then this tutorial is not for you, I know some people do this to prevent loss of members and cookie hackers.
Important stuff
First, you need to make the bot here: Discord Developer Portal
Second, You will need Visual Studio Code: https://code.visualstudio.com/
Third, You will need Node.js: Download | Node.js
Forth, You will need this to invite the bot: Discord Permissions Calculator
Bot hosting websites
Glitch [Not recommded]: https://glitch.com/
Digital Ocean: Guide to Web Development Credit to @TechSpectrum for that.
VPS: DigitalOcean – The developer cloud
Parts
-
Part 1 [Making the bot]
![Tut7|487x405]
First, you will need to go to the discord developers app In the " Important stuff"
Where it says “New Application” Click on that and a screen will pop up like this
This screen
Name it what you want to name it.
Then this screen pops up
Click on where it says “Bot”
And it will ask you this “Add this bot to the app?”
Click yes.
After you click yes this screen will pop up
[Blured the token]
And there Part 1 is done. -
Part 2 Using the resources to program the bot.
So you will need Node.js and Visual Studio Code. In the “Important Stuff”
So you will need to do this
You will need to create a new folder
Name the folder whatever you want
Second, you will need to go in the command prompt.
Windows Key + R
A box will open up
Type “cmd” In the box then click ok.
Then a command prompt will open up
Third, you will need to type this:
cd Desktop
[Blured it due to having my windows username]
Forth, you will have to type this
cd [YourBotNameFolder]
Replace the “[YourBotNameFolder]” To the folder’s name for the discord bot.
Then you will type this:
npm init
It will ask you the following:
Package Name:
Description:
Author:
Then you want to type:
npm install noblox.js
After typing that you will have to type this:
npm install discord.js
After that open your bot’s folder
Click on package.json
And Visual Studio Code will open.
But if it is not set to open for visual studio code then:
It will ask what do you want to open this JSON file with.
Then click on visual studio code.
Then it will open [Visual studio code]
When you’re on visual studio code you will need to do this
Click on the “File” Tab
Then this will pop up
Click “Select Folder”
So you will have to left-click on the sidebar and click new file and name it this
“index.js”
So when you did it you’re done, time for the coding:
- Part 3 Coding the bot
First, you want the variables that is the important thing so the bot can work.
Code for the variables:
const noblox = require('noblox.js'); const Discord = require('discord.js'); const client = new Discord.Client() var cookie = ""; var token = "" //Your discord bots token client.login(token) //Group Config var groupid = 4512072; //Replace it with your roblox group id. //Prefix Config var prefix = "!!" //Change it to any prefix
Ok so now we have the code for the variables now we need it to login!
Login Code:
Also one thing, you will need this code so the command code can work:
client.on('message', (message) => { if (message.author.bot) return; var args = message.content.split(/[ ]+/) })
Ok, so we have the login code now we need to write are command!
Command Code:
if(isCommand('extile', message)){ var username = args[1] if(username){ message.channel.send(`Serching for ${username}`) noblox.getIdFromUsername(username) .then(function(id){ noblox.getRankInGroup(groupId, id) message.channel.send(`Userid: ${id}, Is kickable`) noblox.exile(groupid, id) .then(function(){ message.channel.send(`Kicked ${id}!`) }).catch(function(err){ message.channel.send("Critcal Error Logged to the console") console.log(err) }); }).catch(function(err){ message.channel.send("Fail To Kick!") }).catch(function(err){ message.channel.send("Player is not in the group!") }).catch(function(err){ message.channel.send("That player is not in the group!") }); } else { message.channel.send("That username does not on roblox!") } return; }
Extra Code:
if(isCommand('help', message)){ const embids = new Discord.MessageEmbed() .setTitle('Ranking Commands') .setDescription('1. `help` - Displayes the commands\n2. `extile` - Kicks a player from your roblox group!') message.channel.send(embids) };
Conclusion
Time taken for this: Nearly 1-2 Hours.
So if there are any errors contact me on discord I will be glad to help!
If you have any regarding questions of this contact me on discord.
Discord: nopebacions#5249