Nebulix is a project integrated with Discord to help manage FIRST FRC shirt/merch trades. The application is written in TypeScript using Node.js to keep things simple and as first-come, first-served as possible.
Nebulix is developed to make FIRST FRC shirt and merchandise trading easier by building a Discord bot with ease of creating or managing trade requests, making the exchange fair and efficient between the different parties.
- Create Trade Request Threads in Discord: Automatically create threads in a specified Discord channel for each trade request.
- Automated Trade Request Management: Manage trade requests by handling user interactions and updating the status of trades.
- User-Friendly Interaction Handling: Provide an easy-to-use interface for users to submit trade requests and interact with the bot.
- Form Validation: Ensure all required fields are filled out before allowing form submission.
- ReCaptcha Integration: Implement ReCaptcha to prevent spamming of requests and ensure only genuine submissions.
- Node.js
- npm
-
Clone the repository:
git clone https://github.com/Ne-k/Nebulix.git cd Nebulix -
Install dependencies:
npm install
-
Create a
.envfile in the root directory and add your environment variables:DISCORD_BOT_TOKEN=your_discord_bot_token DISCORD_CHANNEL_ID=your_discord_channel_id RECAPTCHA_SITE_KEY=your_recaptcha_site_key RECAPTCHA_SECRET_KEY=your_recaptcha_secret_key GOOGLE_CLOUD_PROJECT_ID=your_google_cloud_project_id GOOGLE_PROJECT_ID=your_google_project_id GOOGLE_PRIVATE_KEY=your_google_private_key GOOGLE_CLIENT_EMAIL=your_google_client_email
There are two instances in the code where you'll have to change the site key, this will likely get changed in the future:
- One at index.html#L13
- The other at main.ts#L80
- Go to the Discord Developer Portal.
- Create a new application and add a bot to it.
- Copy the bot token from the bot settings page.
- Add the bot to your server and obtain the channel ID where you want to manage trade requests.
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Navigate to the "APIs & Services" > "Credentials" page.
- Click on "Create Credentials" and select "Service Account".
- Follow the prompts to create a service account and download the JSON key file.
- Extract the necessary information from the JSON key file and add it to your
.envfile. This includesGOOGLE_CLOUD_PROJECT_ID,GOOGLE_PROJECT_ID,GOOGLE_PRIVATE_KEY, andGOOGLE_CLIENT_EMAIL.
-
Go to the Google reCAPTCHA Admin Console.
-
Register a new site and choose reCAPTCHA v2 or v3.
-
Add your domain and obtain the site key and secret key.
-
Add these keys to your
.envfile asRECAPTCHA_SITE_KEYandRECAPTCHA_SECRET_KEY. -
Run the project:
npm start
The project consists of two main parts:
- Website End: This part of the system creates the Discord channel thread and sends a message with a trade request. It is handled by the
api/sendWebhook.tsfile. - Interaction Handling: This part handles the interaction when a user clicks the "Claim" button in the Discord message. The
Discord/InteractionCreate.example.jsfile handles it.
To use the Examples/Discord/InteractionCreate.example.js file, follow these steps:
-
Ensure your Discord bot is set up to handle interactions. This typically involves setting up an event listener for interactions in your bot's main file.
-
Ensure your bot has the permission to create threads and send messages in the specified channel.
Note: The Examples/Discord/InteractionCreate.example.js file is meant to be an example or a rough idea of the interaction handling side of the bot and may be implemented differently depending on your bot structure.
- Implement ReCaptcha to prevent spamming of requests
- Create a Trading Override slash command that uses a modal in case the website
- Implement the delete request button
Please read the CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the GNU LESSER GENERAL PUBLIC License - see the LICENSE file for details.


