[Deprecated] Discord to Roblox Ban Bot

What does this do?

This bot allows Roblox game administrators to ban users in there games from a Discord channel, pretty cool right?

What does this bot look like?

Here is what the commands look like in the bot
help - https://gyazo.com/90c236c005acbf4ff704ce80b2cd7e4b
ban - https://gyazo.com/476205c9176aa1153c9e8965a6662d81
listbans (if no one if banned) - https://gyazo.com/d0b8dd1559af84e28c1aeac96a4ba307
listbans (if people are banned) - https://gyazo.com/d681318258bb2300a37e293c7dea0fca
setreason - https://gyazo.com/249a3ca81bba430fbd9241468c167667

How do we (you guys) get it?

Simple! Just follow these steps!

Step 1

Sign into your Glitch.com account if you have one, if not, create one!

Step 2

Make a project, it can be any type - https://gyazo.com/f6f1dda916507fe42a518f20c6116e69

Step 3

Delete all the project files, you’ll be ending up deleting/overwriting them anyways. Your project should now look something like this - https://gyazo.com/97621557d79c873a371b87532bd9a568

Step 4

Open Terminal - https://gyazo.com/8bb540e6602f053e914921a369d5f33d
Type these commads in the command line

wget -O .env https://raw.githubusercontent.com/zachariapopcorn/discord-roblox-ban-bot/master/.env
wget -O db.js https://raw.githubusercontent.com/zachariapopcorn/discord-roblox-ban-bot/master/db.js
wget -O index.js https://raw.githubusercontent.com/zachariapopcorn/discord-roblox-ban-bot/master/index.js
wget -O package.json https://raw.githubusercontent.com/zachariapopcorn/discord-roblox-ban-bot/master/package.json
refresh
npm install discord.js noblox.js keyv @keyv/sqlite express got

You can delete the ‘.wget-hsts’ file if you wish

Step 5

Find the code where it says ‘got(“DIRECT GLITCH URL”);’ replace DIRECT GLITCH URL with your direct Glitch url
Open the ‘.env’ file, you should see a screen that looks like this
https://gyazo.com/9fe1e171a5d7c12ee0066dd25f4166ef

Step 6

Configure the bot
token = The token (or login) the bot will use to login to Discord
subURLForGettingBans = The sub-url thing that the bot would send a request to from Roblox to get bans
prefix = The character that the bot listens to for commands
banPermsRole = The Discord role required to use the commands, case sensitive

Step 7

Make a new directory called data and put a file named db.sqlite in it - https://gyazo.com/ea7ed2dae757a34c8c0f805d03062bdb

Step 8

Now that you are configured and ready to go to the next step, it’s time to use the Roblox scripts! Please go here and here for the Roblox scripts that you need

Step 9

Open a game in Roblox studio and enable https service (as it needs to connect to the glitch server). After that, please make 2 new server scripts in ServerScriptService. The name can be anything, but make sure to paste both scripts in the server scripts (1 script in each other’s script)

Step 10

You would notice that some variables say ‘LINK TO YOUR GLITCH PROJECT’ or ‘SUB URL FOR BANS’ This means that you need to still do a little more configuration, which isn’t that hard, so let’s start

Step 11

For the glitch url, you wanna do what this gif is doing - https://gyazo.com/823bb4c85ac1e5e2e1bf22b9c491f593
After when you got that copied, paste the link in the ‘banURL’ variable for both scripts and add a ‘/’ to the end of it
For the subURL variable, please go back to your .env configuration file and copy the value that’s next to ‘subURLForGettingBans’ and paste that in the subURL variable in both scripts

Step 12

Congrats! You’ve setup the bot (hopefully correctly). Now try to test it, if it works, then yay! You set it up correctly! If it didn’t, either ask for help here or make a Github issue here

Inspiration

I took inspiration from this DF post from a couple months back, though I wanted to make it a little more simple and easier for the average person to understand

Conclusion

Thanks for reading this post on my Discord to Roblox Ban Bot, as it took me a few hours to make and test. If you do like this, you can show your kindness by liking this post, or maybe spreading the word, that’s up to you. If you wish to add something to this bot, make a PR or add a request on the replies, I’m all ears. Anyways, good day and good bye. READ UPDATE POST FOR UPDATES

53 Likes

This project used Glitch, it is not recommended as a hosting service as Glitch has banned Discord Bot hosting without payment. You have to pay to get a discord bot up, most people don’t want to though. You should use something else as a hosting software, as Glitch is not a reliable source. You could use for example repl.it with pinging of UptimeRobot.

I like the way you can check who is banned at that moment, and I like the ban system overall.

11 Likes

They banned pinging services like UpTimeRobot, but requests from like Roblox won’t be blocked, I would’ve used repl, but I’ve heard that it has db issues sometimes @jees1. I was also able to get data to Roblox from Glitch, so I don’t think they block it. Hosting this would also be kinda useless as it won’t be able to do anything if there were no Roblox servers on, only reason is to ban someone when the game has no players, so it’ll be the same time to reboot the bot and to manually ban the user, so there’s legit no point to host it

4 Likes

I mean, repl.it didn’t ban pinging services so why didn’t you use it instead to host your discord bot?

1 Like

@GeneralLPrince Look at that sentence

1 Like

I talked to people at Glitch Support, projects can accept at max 4K requests on the free plan per hour, since the onGame script has a 1 second cooldown, that’s like 3,600 reserved for that (60 x 60), so if I get a lot of complains of a ‘429 - Too Many Requests’ error I might remove game join

1 Like

Glitch is a decent host. We use their premium version on Keyon Air: Flight Simulator to host the ban database and on Animations: Mocap to host various web services. The free version, however, is not suitable for production hosting; do not use it for hosting anything in production!!!

4 Likes

Glitch has stopped supporting hosting Discord bots. If you are going to use this, you are going to either have to self-host it or host it on another platform. Also, you should upload it to github as not everyone may be comfortable with running terminal importing commands on their computers.

1 Like

Heroku is a good free alternative to glitch now that discord bot hosting has been depreciated @zachariapopcorn

2 Likes

I would’ve used Heroku, but when I tried a bot with a database before on in, it kept deleting the database file. Another reason why I didn’t use Heroku is that I really don’t know if there’s like a direct ping url for the project. I also “love” that support is locked behind a paywall. I didn’t use repl because I’ve had database issues on it.
@DevXML

1 Like

If you know how to get Heroku to not overwrite the database, comment below and I’ll check it out. If this bot didn’t need a database, then I would’ve use repl

1 Like

Is there any chance for us to be able to see the source code?

1 Like

You can see if by 2 ways
Running the command that gets the index.js file in step 4
OR
Clicking here
@UnknownZeal

2 Likes

Try using heroku, it reliable and has better uptime

1 Like

2 reasons: 1: Support is locked behind a paywall and 2: Everytime I reboot/redeploy/restart the bot, it wipes data/db.sqlite back to nothing @Ashp116

1 Like

As I’ve stated before on @GeneralLPrince 's Post. You can check it out here.

1 Like

The only reason why there is a webserver in these type of bots is because there’s no api in the public docs that can manage in-game datastores. Since Roblox can make requests to out-of-site apis, but other’s cant do the same for datastores, the webserver acts as the datastore for both (in this case Discord and Roblox) to communicate and send data to one website to the other. If Roblox were to add something like this, the webserver wouldn’t really need be used for storing data, but more for like communicating, which sites like repl and heroku also do good at

But also not the most efficient and completely unnecessary to add an extra 3rd party site for an already easy task such as this.

1 Like

thats y you need to use the database that heroku gives you

Then suggest an API endpoint to save data to games

Can you link me the docs for this database that Heroku has?