How to make a Discord Bot that exiles people out of your roblox group

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]
    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

    ![Tut7|487x405]
    This screen
    Tut7
    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
    Tut10
    Name the folder whatever you want
    Second, you will need to go in the command prompt.
    Windows Key + R
    A box will open upTut11
    Type “cmd” In the box then click ok.
    Then a command prompt will open up
    Third, you will need to type this:

cd Desktop

Tut12
[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.
Tut13
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
Tut15
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 upTut17
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

17 Likes

Yes, there is something wrong it wont say the code in the way I wanted it to.
The way I want it to say
print('Testing')

3 Likes

Or this way

game.Players.PlayerAdded:Connect(function(Plr)
print('A player has joined!')
end)
4 Likes

You should use gist and proper indention

4 Likes

This isn’t exactly fine for a tutorial , the code is messy unexplained and much more. And anyone will be able to run exile. Atleast provide users with a secure bot before making it a tutorial.

3 Likes

Sorry, I am new to the tutorial’s system.

1 Like

Also most of this looks the exact same as @TechSpectrum’s Tutorial code, (Except for a few changes), Im guessing you used his as an Example?

1 Like

Um, no I Just code it my self and it is kinda the same thing but I code it my self.

1 Like

No, the Tutorial Code was coded my him.
This code was my me.

1 Like

Can’t really tell if it’s mine or not but I’m gonna say it’s not - it’s not a copy/paste and so it’s fine. Just indent your code and make it readable.

2 Likes

Ok, thanks for the feedback.
I am very new to this Community Tutorials.

1 Like

I don’t recommend using bots for roblox group moderation. I know of many instances where these kind of bots are abused.

1 Like

I should added more to the Extra Code since people can just “Free Rank” them self on discord.

1 Like

Or this

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
1 Like

It’s not that fact that people can “free rank”, it is the fact that a bot can ban hundreds of members from a group with 1 command, and not even from the Roblox website.

2 Likes

First, This is the extra code for the bot:

if(!message.member.roles.some(r=>["RankName"].includes(r.name)))

1 Like

And the discord server has to have the role to the highest level so no one that has perms to get roles and stuff cant do it.

1 Like

All it takes is one person. Also I don’t need the code lol.

1 Like

What do you mean @mazte if they are going to ruin the bot or so?

1 Like

Could you put your code into ```lua format. It’s currently hard to read.