Discord To Roblox Ban Bot Version 2.0
Hello everyone! Today, I’ve taken into consideration the feedback from the users of the DTR v1 and have decided to make a new and improved version of DTR, which is much more end user friendly and is significantly easier to deploy. This bot once again features a ban and unban command, and is completely 100% cost-free.
How does it work?
The Old System
The old system: The old system works off of the diagram below. Roblox sends API requests to google sheets which grabs the data from the sheet, in which that data is set by the node.js server using discord.js to gather user commands.
The NEW system: The new system is much simpler and is made on a more reliable structure, which utilizes Roblox’s data store and a single node.js server hosted on glitch
This Discord bot portion works by listening to a Prefix which is easily set in the server code and listens for 2 basic commands with a simple syntax:
Banning/Unbanning (Unban command is simply ;unban user)
v2.2 now has a kick feature!
When the bot cant auto determine the user:
This bot also features username and userid verification to make sure you never send an invalid request:
How to deploy this bot for your game!
-
First we need to make a Discord bot, go to your Discord bot Dev page (https://discordapp.com/developers/applications/ ) and press “New application”.
-
Follow this video to turn it into a bot:
-
Once you have successfully created a bot, you’ll need to create an account on glitch.com. Glitch is a free place for people to build simple web applications using JavaScript which then run on remote servers which you can send requests to. This is where we will be deploying the nodejs server.
-
Once you have made a glitch account, you will need to “remix” my source code, which can be found here:
https://glitch.com/edit/#!/disc-to-rblx-example
GitHub Repo: https://github.com/Stratiz/Discord-To-Roblox
-
In order to make this project your own (AKA: Remixing), follow this video:
-
Once you have your own project, you will need to go back to your discord bot page and get its token in order for the bot to come online, as well as place the token in the server’s .env file. This is important in keeping your bot secure. Follow this video:
UPDATE: Glitch modified their UI. The page may look like what’s seen below now. Paste the token into the Variable Value field.
DISCLAIMER: NEVER SHOW ANYBODY YOUR BOT TOKEN!
7. Once all of that is done, you will need to add your bot to your server:
-
In your server, make a role. This role will be used to give users the ability to interact with the bot. Copy and paste the role name into the top of the script where it says
let rolename = "rolenamehere"
-
Place this script into
ServerScriptService
and modify theNodeUrl
value to equal the LIVE APP url of your own project. You can get this live URL by pressing share in your project, and then pressing live app.
DTR v2.2.lua (4.0 KB)
(UPDATE: Added kick functionality) -
Done! You should be all set to use your bot properly to ban people from Discord!
Detailed feature explanation
- UserId and Username Verification
This works by utilizing a Roblox web API. Whenever you supply an and ID or username to the command, the bot will send out a simple get request to Roblox, which will then check the response code and the returned JSON data to determine if the user is valid. This is a major improvement from V1.
- Anti-API Exhaust
In V2, I’ve developed this to be usable in projects as small as Dedoxed or as big as Adopt Me. That being said a common problem which people often run into in large games is exhausting the API limit, which can easily become a DDOS with the amount of power Roblox has. To solve this problem, I’ve developed an Anti-Exhaust system using Roblox’s messaging service. This creates a communication channel for the servers to coordinate which server should and shouldn’t be sending API requests. At most, 4 servers will be sending out requests to the node, which ensures you stay within the 66 req per min. Because I dont have any super popular projects, I haven’t been able to test this on a large scale. If anyone has the ability to do so, please let me know how it goes.
- Stable code
In V1, the code we wrote was lackluster and had a lot of flaws particularly on the NodeJS side. This is primarily because we were inexperienced. We still do lack in some areas but we’ve both become significantly better at Javascript and web development. This time, there is coherent error handling and proper promise catches, which is something that may cripple v1 in the future as it utilizes deprecated techniques.
Closing thoughts
I’ll be making an FAQ for this project rather soon and I’ll be actively updating this with more features.
Special thanks to @Kensizo for getting me motivated to keep working on this project! This wouldn’t have been done without him.