[Deprecated] Discord to Roblox Ban Bot

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?

You’re never gonna believe me… It’s a cool new revolutionary thing called a Datastore

2 Likes

It’s significantly better than using google spreadsheets as a database, but the code needs a massive cleanup.

A few things:

  1. Don’t store a discord bot and a web server in index.js, make them separate modules.
  2. if(request.method !== "GET") return response.sendStatus(400); is this necessary? You’re using app.get, that already ensures It’s going to be a get request.
  3. You need to add client.on('error', console.error) or else your discord bot will crash whenever it runs into an error (it will).
  4. Your bot will benefit greatly from a command handler.
  5. The Lua portion needs a lot of work.

Just my two cents.

I know right, funny thing is that, oh idk, there’s no api to update it. If there is, would you link it to me?

Thanks for your feedback! This reply is just meant to answer the things that you listed above

1: I’m used to writing a Discord bot’s source code in 1 file
2: I always thought that app.get() meant that it’s getting a reply from the “sub url” in the first argument, though I’ll remove it after when I’m done typing this post
3: I’ve barely used client.on(‘error’) because all the errors I’m gotten while writing bots were solved by using try/catch
4: It’s easier for me to code in one big file then separate it within different files. I’m also used to it
5: In what way?
@Meta_data

There’s no need, On the player’s ban it is as easy just to run

local function ban(plr)
    plr("You have been banned.")
    
    banList:FireServer(plr) 
end

to fire if the user is indeed banned and tried to rejoin, such as pulling from the datastore if set up properly with logging the players UserID incase any name changes happen. I can show you how this type of system works and how I personally log my bans if you’d want to see it functioning.

1 Like

I’d like to see your way on how you do it with the way that you explained in the previous posts

Surely, Feel free to reply back to me over discord.

What goes in the subURLForGettingBans bit? I don’t understand what you mean. Do you mean a Discord webhook?

I’ll give you an example
Say you own roblox.com and then in that value you put login
Now you can do roblox.com/login where roblox.com/ would be your domain and login would be like a sub url for that domain

Update 9/25/2020

  • Added self-ping function in Glitch, intervals at 4 minutes