Discord To Roblox Ban Bot
Update as of 12/8/19
This source has been used by phenomenal games like Vehicle Simulator, and many other great games. A few months ago me and @Belzebass had decided to add on to Discord To Roblox Ban bot, to be able to have large games support this bot, without it bugging out and or rate limiting whilst still using these sources. If you wish to have this addition , download this lua file and add it to your Roblox game.
ban_system_kensizo_and_belzebass.lua (2.5 KB)
Please note you do have to change some areas of the glitch bot, screen shots provided:
Old;
New;
Please keep in mind there is some added code in there, for a personal test created.
Basically what needs to be changed, is where the bot is posting a request to your sheet.
The ban post request to change to:
axios.post("https://script.google.com/macros/s/" + scriptID + "?sheet=Global&key=" + args[1] + "&value=" + true + "&reason=" + reason + "&moderator=" + message.member.user.tag, {});
The unban post request to change to:
axios.post("https://script.google.com/macros/s/" + scriptID + "?sheet=Global&key=" + args[1] + "&value=" + false + "&reason=Unbanned" + "&moderator=" + message.member.user.tag, {});
You also need to add these to the spread sheet you have:
Please watch out for more updates to this bot, and possibly a version two. Thank you all for the constant support and suggestions, we really appreciate it. We hope you enjoy this optional addition!
Hello! Today we present a Discord Bot, that is 100% open source and free to use. This bot and functions have been created by @Stratiz and @Kensizo . Us two teaming up, have decided to create this for the community. This bot features a ban, and unban command, and this stores on a google spreadsheet, so it is 100% free to use, and simple to set up. This mainly uses the platform glitch, to run the Discord bot for free. Now of course, you can easily run this bot on a Web Hosting, but we understand some users do not want to invest money into Web Hosting, which is completely fine, and this solution now exists.
Please do note, we did not fully create the Google Sheets section to this, and the Google Sheets section is just us modifying it and making it better, check this thread;
https://devforum.roblox.com/t/using-google-spreadsheets-as-a-database/12658
To get a better understanding of Google Sheets, we will also explain it in this post, and how to set up everything.
How does this work?
This Discord bot works by listening to the Prefix and checking if it is the ban or unban command. This bot and ban system works by UserIdâs, you can easily make it usernames, by changing it up. Here is a representation of this bot in action;
https://gyazo.com/dceadb9372c565f66fd8cba545860e38.gif
And here is the output of this action;
The server on Roblox, then checks and sends a GetRequest to see if the playerâs UserId is there, if it is , it checks if the BanValue ( or just value in this case ) is equal to true, if it is, the server kicks the player. To make the bans more instant, we added a while wait() do statement, and it then constantly checks if the player(s) in the server(s) userIDâs are on the sheet. If it is on the sheet, and the value is equal to true, it kicks them. So this means it does not have to be the player joining every time, making it more convenient. If the Discord User then does unban UserId, it checks if that UserId is on the sheet, if it is, then the value turns to false, so then every time the player joins, or when the server constantly checks the sheet, it wont detect them as banned, as the value isnât true. Here is how it looks when you unban a UserId;
https://gyazo.com/81f3769551c5f362340f4467ea5524ed.gif
And here is the output of this action;
How do I set up this system?
Itâs actually pretty simple! Here are some step by step instructions, we did to make this work!
- Create your Google Spreadsheet.
To create a Google spreadsheet is simple, visit this site; https://docs.google.com/spreadsheets/u/0/
- Rename your Google spreadsheet to âGlobalâ
https://i.gyazo.com/2d652d9abe526443dae9441098101d40.mp4
3. Set up your game, and add this module;
DiscordToRobloxBanning.rbxm (1.7 KB)
Make sure the script and module are in ServerScriptService!
-
(Hi its Stratiz now) Go to your Discord bot dev page (Discord Developer Portal) and press âNew applicationâ
-
Once your app is created, press the âBotâ tab and press âAdd botâ. Keep this page open, youâll need it again in a later step.
-
Sign up for glitch.com and check out our source code:
From that page you should be able to branch it (AKA Remix).
- Enter the server.js tab and look for the var token.
-
From the page in step 5, press copy on bot token (KEEP THIS SECRET) and paste it into the token variable. This token is what allows your bot to come to life.
-
(Kensizo has joined the server) Basically, you now need to create a marco script. But before that, we must set up your values, to set up your values, add âkeyâ and âvalueâ in row 1.
-
We now need to freeze the row, to freeze the row, follow what this GIF does;
(FYI: When pressing freeze, Freeze 1 row, no more than 1.)
- Add the script, to do this again follow what this GIF does;
( A new page shouldâve opened, once that has happened, do the following.)
-
Change the script name to Database Macro.
-
Paste this script into the Marco;
-
After that, while on Database Marco, press File>Save All ( This will save all the progress)
-
Press Run, this will run the script.
-
Press Publish, and then press deploy as web app:
-
Make sure you have the following settings for your script while publishing it;
-
Publish the script, and copy the ScriptID in between https://script.google.com/macros/s/ and /exec , all you will need is this scriptID.
-
Now in between the quotation marks, paste the ScriptID in there.
Last step: Lets go back to the Glitch Discord bot, paste your script ID in the following;
That is how to set up the Discord-To-Roblox ban bot!
Make sure to let me and @Stratiz to know what we should add, also make sure to leave feedback, and let us know how you like the bot!
Things to note
-
This Bot does not feature a moderator-only feature, so we highly recommend making a server either for only moderators, or adding an if statement to check if the Discord UserIdâs match to a moderation list.
-
You must have HTTP Requests turned on in Roblox.
-
Sometimes, sending or requesting to much information will at one point be stopped, due to these limitations, the bigger your game is, the higher we recommend to have the while wait() statement in the script. Here is a list of the limitations;
Quotas for Google Services  | Apps Script  | Google Developers -
This is meant to be a project for you build off of, you can leave it as is, but itâs highly recommended that you learn from it and adjust the project to fit your needs.
-
The only time data âwonât saveâ or will not register to the spread sheet, is when Googleâs servers are down. ( Googleâs servers are rarely down, so you most likely have nothing to worry about )
-
To change the Prefix of the Discord bot, weâve left a Prefix section, and you could change it from ; to anything whenever you need to.
-
After requests, weâve made the bot be able to handle errors.
-
This bot does not feature an admin only system, but feel free to create a role and add this before the ban commands are put to play;
if (message.member.roles.some(role => role.name === 'ROLENAME')) {
(Also note to add a } near the end where an error appears if you added the role system)
What it should look like if you added the statement;
We hope you enjoy this project and hope you find a use for it!
Stratiz X Kensizo