Discord-To-Roblox Ban bot

I’d use Mongo over SQLite. Anyone can easily edit data via the website and I personally feel Mongo is more versatile in general.

2 Likes

Most likely will never happen with an understandable amount of issues;

  1. How would you verify the game instance?
  2. What would stop trollers and/or bots from just spamming the database to their advantage?
  3. How can this be properly throttled (ratelimits)?
1 Like

It’s very easy:
Roblox can use the rate-limits from in-game instances. People can spam that on the same way as how they can spam on the Internet. Verifying game instances isn’t required, as we’ll use an API key, right? (That’s what @CleverSource stated.)

1 Like

I’m getting this error.

    SyntaxError: Unexpected token )
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:617:28)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3 

What do I do?

1 Like

Hey! Could you screen shot the full error? I am guessing you edited some areas of code, and you didn’t do it properly.

2 Likes

All I did was copy the source.

1 Like

Did you put your Discordbot token where it belongs? In brackets?

"BOTTOKEN"
2 Likes

I did all of that, I even copied the source into another project, the unedited copy.

1 Like

In response to the error, I have rooted the cause of the error to this section:

client.on('message', (message) => {
    if (message.author.id != BOTID) { 
     if (message.member.roles.some(role => role.name === 'ROLENAME')) {
        const args = message.content.slice(prefix.length).split(' ');
        if (isCommand("Ban", message)) {
            console.log("Banning player UserId " + args[1]);
            message.channel.send("Banning player UserId " + args[1]);
            axios.post("https://script.google.com/macros/s/" + scriptID + "?sheet=Global&key=" + args[1] + "&value=" + true, {});
          //Unban the user
        } else if (isCommand("Unban", message)) {
            console.log("Unbanning player UserId " + args[1]);
            message.channel.send("Unbanning UserId " + args[1]);
            axios.post("https://script.google.com/macros/s/" + scriptID + "?sheet=Global&key=" + args[1] + "&value=" + false, {});
        }
    }
});

There seems to be a missing closing curly brace for one of the if statements. A proposed fix could be:

client.on('message', (message) => {
    if (message.author.id != BOTID) { 
        if (message.member.roles.some(role => role.name === 'ROLENAME')) {
            const args = message.content.slice(prefix.length).split(' ');
            if (isCommand("Ban", message)) {
                console.log("Banning player UserId " + args[1]);
                message.channel.send("Banning player UserId " + args[1]);
                axios.post("https://script.google.com/macros/s/" + scriptID + "?sheet=Global&key=" + args[1] + "&value=" + true, {});
                //Unban the user
            } else if (isCommand("Unban", message)) {
                console.log("Unbanning player UserId " + args[1]);
                message.channel.send("Unbanning UserId " + args[1]);
                axios.post("https://script.google.com/macros/s/" + scriptID + "?sheet=Global&key=" + args[1] + "&value=" + false, {});
            }
        }
    }
});
3 Likes

Just realized the code was errored after an update we made, thanks for informing us. We’ve issued a fix and the script(s) should now work.

3 Likes

Bot not posting on google sheet. Any idea what going on? I checked ScriptID and stuff. I even redid the setup from discord part and up.

1 Like

Make sure to check for if the bot is online, and that there is no errors in the bot logs. Once thats done, make sure you also do Run>Setup on the script, I know a lot of people miss that. If you missed running and setting up the script, and you just did it, just simply republish.

2 Likes

Worked! Thanked you! @Kensizo!

1 Like

No problem, if you continue to have issues make sure to post them here! Me and Stratiz are constantly checking this post to help users. From what advice I can give you, is make sure you follow every step, they are written to be followed, nothing can be skipped, we made our throughout research to make sure that all users get a working system; even being a system recommended to / or intended to be edited to be used to your comfort, it can be used as-is. Anyways, enjoy!

2 Likes

Question: Can this ban groups or this plan in possible future?

1 Like

This is really easy to do, you could add a groupban command and store groupbandata on a spreadsheet, and then on the roblox game you kick the person if they are in one of the groups in the sheet.

2 Likes

Do I need change anything script for Google Speardsheets or only glitch and ROBLOX game?

1 Like

Glitch and the roblox game, because what you could make it do is store groupdata instead of useriddata.

2 Likes

Thank you so much for this! Just implemented this for our project, and it’s absolutely wonderful!

2 Likes

@Kensizo can it store both or one??

1 Like