Setup Tutorial

This page will tell you how to set everything up correctly and how to make it work. Later, you'll be able to see how to set up new commands within ROBLOX, not Discord and NOT how to build them.

API / Variables

apiKey

This is already set up for you, nothing needs to be changed here c:

url

Within the "url.url" variable, set the string to be your hosting destination. You must have a "/" on the end to make sure that string parsing works correctly.

rauth

You'll need to make a random string. For example, use a random string generator. Add this random string to rauth.key. After you've done so, head over to this site and hash this string with SHA256. Put this hashed string in your JS external server. Set the constant variable "PRESET_RAUTH_HASH" on line 115 to your hashed string. Make sure that special characters do not interfere. Upon changing one string, you must re-hash the other. In ROBLOX, it should be unhashed; JS should be hashed.

DISCORD

Bot Setup

Head over to the Discord Developer Portal. After you've done so and you're logged in, make sure to hit "New Application" in the top right. Give it any name you want, agree to the DToS and DP, and hit create. You should now be in the bot's page. On the left, go into the installation tab. Uncheck "User Install", and switch the Install Link to "None". Save changes. In the OAuth2 section in the left panel, scroll down to the "OAuth2 URL Generator". Select "Bot". You may now give it any permissions that you would like it to have. The default commands require no permissions. At the bottom of the page, make sure the integration type is set to "Guild Install". Copy the generated URL, paste it in a browser and add the bot to your DISCORD server. Now, on the left, head over to the "Bot" section. You must now "Reset Token" under the "Token" header. Copy this token and head over to your JS server. Find config/dc/config.env, and set the BOT_TOKEN to the token you just copied. In the bot page under where you just copied the token, disable "Public Bot". Save changes. Now, head over to your DISCORD server, and copy the guild ID. In config.env, replace GUILD_ID with the numbers you copied. If you do not know how to copy a guild ID, check this page out. Everything should be set up correctly for the DISCORD bot.

Dependencies

Installing Dependencies and Setting up Node JS

Install node JS on your hosting service, you may find sources online on how to do so. Head over to your JS server files. Go to package.json and find "dependencies". In your console, you must run "npm install [dependency name]". This will be listed. If for whatever reason you cannot find it, run the following command: npm install discord.js dotenv express sqlite3. After it's installed, you're all set. Make your hosting service run /api/index.js to start your server up.

Adding new Roblox Commands

Making modules

You should make a module script under the "Executors" folder. Make it return a function. See below for an example of a working command script.
return function(data)
    print(data)
end
That is how it should be structued: a function being returned and only accepting one parameter. "Data" is the rest of the string after parsing command name. Data can be nil if only a command name is provided during an API request.

Defining Commands

You should define all commands in ServerScriptService/api/getInboundData on line 12. Add the command name and set the value to require the module script you created under executors. For example:
local commandDictionary = {
    kill=require(exec.kill),
    kick=require(exec.kick),
    log=require(exec.log)
}

Comamnds in Discord

Setting up Command Permissions

In /discord/groups.json, you need to specify command names. They're already done for you. However, you must specify groups that commands are in and what roles people have to have etc. For example:
{
    "groups":{
        "staff":{
            "roleIDs":[
                "1469245319014514790"
            ],
            "userIDs":[
                
            ],
            "blacklistedRoleIDs":[
                
            ],
            "blacklistedUserIDs":[
                
            ]
        }
    },
    "commands":{
        "about":{
            "enabled":true,
            "everyoneCanUse":false,
            "group":"staff"
        },
        "search":{
            "enabled":true,
            "everyoneCanUse":false,
            "group":"staff"
        },
        "apikey":{
            "enabled":true,
            "everyoneCanUse":false,
            "group":"staff"
        },
        "execute":{
            "enabled":true,
            "everyoneCanUse":false,
            "group":"staff"
        },
        "players":{
            "enabled":true,
            "everyoneCanUse":false,
            "group":"staff"
        }
    }
}
Based on this, configure the default "staff" group to do the following. Add any role ID that is used by staff in a string. Any IDs of users or roles in a list must be as a string to work. Blacklisted always overpower whitelisted.