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

Yes, I will next time.
How do you edit this?

1 Like

You click the pencil icon on your post.

2 Likes

Like the code that I posted for my topic.

1 Like

You put ```lua over the first line of code, then put the three ` under the last line of code.

1 Like

Ok, But I want to edit the topic code that I putted, so I can update it.

1 Like

I already told you, you just click the pencil icon on your topic.

Also, who ever is seeing this this is my discord now:
yesbacions#5249
So you can contact me when needed!

console.log(); is how you do it in Node.js.

I can’t contact you, it says you aren’t accepting friend requests and that you have to add me to become friends. My discord is nano#6666 and you might wanna fix this for the future.

zackiyboi#2728
That is my discord.

Thanks for the tutorial! Even if people may not like this one for whatever reason, never stop contributing! All the code you release is helpful, even if it may not be perfect. Thanks for this!

2 Likes

It would be helpful for you to include how to get the cookie of the account.

1 Like

Yes, but you will need the cookie, and your bot needs perms to Kick users from the group!

1 Like

Oh, ok here is a way to do so.
First, you will need to go to the members tab and click on the 3 dots then it will say
“Exile User”
df

1 Like

If your the owner of the group, yes you can if anything goes wrong.

1 Like

Well, I had some extra code so that might help.

1 Like

Here are some extra code that I did not add.

Anti DM So people cant exploit the bot.

client.on('message', msg => {
    if(msg.channel.type == "dm"){
        message.channel.send("Sorry, I don't function in DMS!")
    }
})
1 Like

that will cause the bot to start spamming dm.

client.on('message', async message => {
     if(message.channel.type == "dm"){
         if(!message.author.bot) return  message.channel.send("Sorry, I don't function in DMS!");
    }
})
1 Like

Updated Code
Well, it works now!

const discord = require('discord.js');
const noblox = require('noblox.js');

const client = new discord.Client()

var token = ""

client.login(token);

//Vars
var cookie = ""
var prefix = "!!"
var groupId = 0
var minrank = 0


function login() {
    return noblox.cookieLogin(cookie);
}
 
login()
    .then(function() {
        console.log('Logged in.');
})
    .catch(function(error) {
      console.log(`Login error: ${error}`);
});

function isCommand(command, message){
    var command = command.toLowerCase();
    var content = message.content.toLowerCase();
    return content.startsWith(prefix + command);
}
 
client.on('message', (message) => {
    if (message.author.bot) return;
    var args = message.content.split(/[ ]+/)
  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\n" + err)
                             console.log(err)
                         });
                        }).catch(function(err){
                            message.channel.send("Fail To Kick!" + err) 
                    }).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;
  }
})
2 Likes
const discord = require('discord.js')
//```javascript

Use that, it works.

1 Like