Discord to Roblox Moderation Bot

Introduction

Hey there! I’m the creator of this bot where it allows game administrators to make bans on Roblox from Discord. Now that I look at it, it has a LOT of flaws and bugs and overall bad coding practices. An example of this is me using one file for everything, which resulted in unorganized code and basically just a mess of a bot. Think of this as a rewrite as you will

What does this bot do?

Simple! It allows you to do moderation actions, like kick, ban, shutdown, etc, remotely

Showcases

I’m not going to show every bit of detail that’s in this bot, so I’m just going to show you the help menu

How do people get it?

Simple! Just follow the steps that I link below

Step 1

Make a repl account and create a Javascript/Node.js repl

Step 2

Once you have created the repl, open the shell the type these commands

git clone https://github.com/zachariapopcorn/discord-roblox-moderation-bot.git
mv ./discord-roblox-moderation-bot/* ./
rm -f -r -d -v discord-roblox-moderation-bot/
rm RBXFiles.rbxm

Please note that you might need to refresh the page for the changes to fully apply
Want a video? Here you go → This doesn’t show me doing the last 2 commands as I edited them in later, just type them out, it deletes the junk files

Step 3

Go to the secrets tab and make variables in this order

token=YOUR_DISCORD_BOT_TOKEN_HERE
allowedRanks=Admin Permissions,Game Permissions

prefix=?
cooldown=10
embedColor=BLUE

Want a video? Here you go

Step 4

Configure your environment variables

By default, the roles that are named Admin Permissions and Game Permissions are the roles that are required to use most of the commands of the bot. You can change this in the allowedRanks setting, just remember to separate them with commas and no spaces

To get your Discord bot token, go here, click “New Application”, name it, go to ‘Bot’ and click the button that says ‘Create a bot’ (or something like that) then click ‘Copy’ under where it says ‘Click to Reveal Token’, paste that into the token value

The prefix is the character the needs to be in front of commands in order for the bot to register it

The cooldown is the command cooldown in seconds

The embed color is the embed color for the embeds that the bot returns

To private the bot, uncheck the check the says ‘Public Bot’

PRIVATE THE BOT, PLEASE

Want a video? Here you go → This doesn’t show me privating the bot, but I think you can figure it out

Step 5

Invite the bot to your server
Basically, edit the client id into this link where it says ‘CLIENTIDHERE’, paste it in your browser, click enter, and then fill out the form

https://discord.com/oauth2/authorize?client_id=CLIENTIDHERE&permissions=8&scope=bot

Step 6

Turn on the bot via the ‘Run’ button on the repl. At first launch, it should be installing the required packages, then it’ll log into the bot account

Step 7

You now have the Discord bot portion setup, onto the Roblox portion!

Download the files from here: raw.githubusercontent.com/zachariapopcorn/discord-roblox-moderation-bot/main/RBXFiles.rbxm

Step 8

After when you downloaded the roblox files, input them in ServerScriptService in your game, then ungroup them

Step 9

After you ungrouped the scripts, find the script called ‘Loader’, there, you will see that a variable name is called _G.baseReplUrl, change it’s value to the url that’s appeared after you started the bot, for a hint, it ends with .co

Step 10

Publish the game

Step 11

Go to UpTimeRobot and login/create an account

Step 12

Once on the dashboard, click ‘Add New Monitor’ and have this for the configuration

Monitor Type: HTTP(s)
Friendly Name: discord-roblox-moderation-bot -> This can be whatever you want though
URL (or IP): The link that you copied for the Roblox setup, remember, the one that ended with .co
Monitoring Interval: Every 5 minutes

Step 13

Enjoy your moderation commands

Conclusion

Thanks for reading my post about my Discord to Roblox moderation bot

Poll

Who found this helpful?
  • I did
  • I didn’t

0 voters

If you voted “I didn’t” then please tell why in the replies, but it’s up to you

69 Likes

That’s cool dude keep the good work :slight_smile:

5 Likes

Reason why I said “I didn’t”:
I already have programmed many discord bots and know the process.


Just want to clarify… the files are set up correctly in command folders, right? And there is a keep_alive file (http server) so UptimeRobot can actually ping the bot?

1 Like

Is it just me or does the download link not work? I inspected the link and this is all that pops up

"Download the files from " == $0 <a>here</a>

1 Like

Yea I fixed the link, so sorry about that, it wouldn’t let me post with https:// so I just had to put it there with no hyperlink

1 Like

Yes the commands are setup in the folder correctly in to repo

This isn’t needed, I’ve also done hosting projects like this, all I needed was the webserver url that starts up when you start the project, and boom, uptimerobot is setup

EDIT: Read that wrong, the index.js file contains the webserver stuff

1 Like

Awesome got it working, I really enjoy the idea of being able to perform moderation from the ease of discord. Well done.

3 Likes

I made something like this but it also has Discord Lua script execution and rank changing. It also can do the same thing from a website so if Discord is down, I can use my website to command my game and vice versa.

This has Discord Lua script execution

I never saw rank changing as part as ‘in-game moderation’

1 Like

Rank changing for moderators so they cannot access certain commands, and the Discord Lua script execution you type in some Lua code in Discord and it executes it inside of all servers.

How can I get the jobId of a specific server?

1 Like

print(game.JobId) then copy the long string or do "prefix"getplayerjobid raveeety

This has that built in as a feature

No??? And if so which feature?

The eval command has a global setting to it which runs code on all the servers

Eval executes raw javascript code, my admin takes the code, puts it in a database, then the Lua script sends a request to my expressjs webserver returning the code. So no???

Did you even look at the code? There’s 2 settings on it, node and roblox, node will run Javascript code, while roblox, if global supplied, will run the supplied Lua code on all the servers

Hey man, this is awesome. However, you need to give the UI a serious rework.

I have already done so, hopefully, you can implement this into the actual code.
I’ve tried to keep it relatively similar to the previous ui’s structure. And here it is:
UI stuff lol.rbxm (9.4 KB)

Notice: I highly recommend not doing transparency tweens, instead, just tween the position.

What’s wrong with it?

I do appreciate that you took the time out of your day to do this, though once again, what’s wrong with the current UI?

How come? Also, this was my first script that uses TweenService

2 Likes

So basically, the previous UI actually increases script activity quite a lot. Also, the UI isn’t very good for UX (User Experience). I believe that most users would find it rather confusing due to the extremely large divider in the middle. A few other notes are that we need UIAspectRatioConstraint for a standard ratio for the UI, anchor points for more accurate positioning, and UICorners should be changed to scale instead of offset.

For TweenService, I highly recommend not creating a tween for every single element, instead, have the main container be tweened off-screen.

Another note is that UI tweens should be handled on the client, never do that on the Server.

Your bot is amazing! I greatly hope you can listen to my suggestions and make it even better.

1 Like