[V2] Discord-To-Roblox Ban bot | 100% Free, End User Friendly & Stable!

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.
image

The NEW system: The new system is a 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

image
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 via UserId:
image

Banning/Unbanning via Username:
image

This bot also features username and userid verification to make sure you never send an invalid request:

image

How to deploy this bot for your game!

  1. First we need to make a Discord bot, go to your Discord bot Dev page (https://discordapp.com/developers/applications/ ) and press “New application”.

  2. Follow this video to turn it into a bot:

  3. 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.

  4. 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

  1. In order to make this project your own (AKA: Remixing), follow this video:

  2. 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 servers .env file. This is important in keeping your bot secure. Follow this video:


    DISCLAIMER: NEVER SHOW ANYBODY YOUR BOT TOKEN!
  3. Once all of that is done, you will need to add your bot to your server:

  1. 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"

  2. Place this script into ServerScriptService and modify the NodeUrl 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.1.lua (3.8 KB)
    (UPDATE: Players will now be kicked on ban)

  3. Done! You should be all set to use your bot properly to ban people from Discord!

Detailed feature explaination

  • UserId and Username Verification

This works by utilzing 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 a 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 made this thread at 4 am so I may have missed something, I will be actively reviewing and editing code as problems arise. Please feel free to stress any comments or concerns you have, if you need assistance contact me on Discord @ Stratiz#7821

Special thanks to @Kensizo for getting me motivated to keep working on this project! This wouldn’t have been done without him.

85 Likes

How is the data stored? SQL? JSON?

4 Likes

Ban data is stored via Roblox datastore, information is transferred via Headers in GET requests and JSON response

3 Likes

Awesome project! Even though i don’t get why someone might wanna ban a player using discord :confused:

4 Likes

It is for convenience.
Say you were on your mobile device and wanted to ban a user - you don’t have access to Roblox studio.

4 Likes

This is a great tutorial - I have been using my own system similar to this to store codes, bans, live event data and much much more.

My only critique would be that you use SQl / MySQL to store the bans.

4 Likes

That reply gave me a small existential crisis and its made me realize that despite seeming potentially useless (keyword potentially) , it holds much more power than its face value. Currently this is configured to work as a ban bot, but this is essentially just a communication channel from Roblox to discord and can be repurposed for all sorts of things.

6 Likes

What if you forgot who was banned? That would be an inconvenience (sometimes the search bar on discord doesn’t seem to work for me so I can’t really search them by their name or Id maybe that’s just me lol)

3 Likes

I guess that is a flaw with this current system as there is no easy visualization of who is banned.

My system has a visual to show a list of banned users with reasons.

2 Likes

Hey Stratiz Glitch started doubling down on apps that supposed to be running 24/7. I’d watch out with deploying the bot on their site.

3 Likes

Great! I was planning to create a testing server and this bot will help me a lot. Thank you!

3 Likes

This tutorial was fantastic! I might be using this soon.

3 Likes

Holy, this is amazing! This is gonna be very useful…

3 Likes

This is really awesome stuff! I wish it wasn’t just one role, however, so you could have, for example, admins being able to ban, while moderators only being able to kick, mute, etc.

4 Likes

I did all the instructions correctly, the bot is up and running, but it won’t respond to commands, how do I fix this?

EDIT: Nevermind, I got it to respond to commands, how come it takes so long to ban?

4 Likes

Good to hear you got it working! It the time it takes to actually ban can take anywhere from 1 - 6 seconds, while the time it takes for the bot to get a response from the roblox server can take up to 12. This is because the communication channel is not a direct line to the roblox server. The ban sits in a queue where it waits for a roblox server to ask for a request. Because all the services this bot utilizes are free, there are very strict API limits which we have to abide by which contributes to the slight delay. Although in most scenarios having a few seconds of delay for a ban is hardly a problem.

3 Likes

12 seconds or minutes? Either way, I’ve been waiting 14 minutes for a response.

3 Likes

it should never take more than 12 seconds. If you dont have any servers online your game the ban wont go through because there are no roblox servers online to handle your request. Make sure you have HTTP request enabled in your game settings and you’re not experiencing any errors on the roblox side.

3 Likes

Ah, alright, thanks for the info.

3 Likes

I’m having issues getting the bot to reply to commands.

3 Likes