Repository navigation
Installation & Setup
Welcome to the QCBot Installation & Setup wiki page! In this guide, you will learn how to set up QCBot for your own Discord server!
Important
Here, we will install and run QCBot locally on a computer. This implies that whenever your machine is shut down, the bot will go offline too. For more information, please read the warning at the bottom of this page.
In order to use QCBot, you will need to download and install Node.js, a JavaScript runtime environment. Originally, JavaScript was a language that only worked on web browsers. However, the Node.js runtime can be used to run it outside of a web browser, e.g. locally on your computer or remotely on a virtual machine (VM).
Firstly, to check if Node.js is already installed on your computer, open a terminal, type node --version and press enter. If it outputs a version number equal or superior to 16.11.0 1, you can directly go to Step 2. Else, follow the steps below.
There are many ways of installing Node.js, but if you are on Windows or macOS, I recommend using the Prebuilt Installer for a simple and straightforward installation. Simply download the correct installer for your OS, open it and follow its steps.
Tip
You can choose to download either the latest Current version, which contains the most recent features, or the latest LTS (long term support) version, which has been tested for longer and is highly stable. You can pick whichever you want, but QCBot works perfectly fine with the LTS version (QCBot has been developed and tested on v20.13.1 of Node.js).
For this step, you can follow the discord.js guide. Carefully save the bot token as you will need it later.
To add a custom bot to your server, you will need an OAuth2 URL. To obtain one, you can either:
- Generate one by going to the My Applications page of the Discord Developer Portal, clicking on your newly created bot application and going to the
OAuth2page. Then, underOAuth2 URL Generator, tick theapplications.commandsand thebotoptions and select the permissions the bot will need. - Use the pre-made one below and replace
BOT_CLIENT_IDwith the actual ID of your bot (you can obtain it by going to the My Applications page of the Discord Developer Portal, clicking on your bot application and copying theAPPLICATION IDfound in theGeneral Informationpage).
Tip
Pre-made OAuth2 URL: https://discord.com/oauth2/authorize?client_id=BOT_CLIENT_ID&permissions=824969382976&scope=applications.commands+bot
Next, paste your OAuth2 URL in a web browser where you are logged in to your Discord account and confirm you want to add the application to your server. It will now be added to the server you selected and will wear a special integration-managed role containing all the permissions it needs to operate. To ensure the bot can properly function, please place its special role ABOVE the ones it needs to give/remove from your members.
Here, you can choose between two methods:
- If you have Git installed on your computer, you can clone the bot's repository by opening a terminal in the folder where you want the code to be stored, type
git clone https://github.com/Antasma245/QCBot.gitand press enter. - On the main page of the repository, go to
Codeand pressDownload ZIPor click here. Then, extract the downloaded ZIP archive where you want the code to be stored.
You can also use these methods on your own fork of the repository (do not forget to adjust the links accordingly). Learn more about forks
On the main page of the repository, under Releases, go to template.env (or click here for quick access) and follow the instructions listed there. Once you have obtained and renamed the file, place it in the main directory of the bot's code (where the index.js file is located).
Open the .env file in a text editor and replace the placeholders with the necessary information. If you do not have the option to copy user/role/channel IDs on your Discord, follow this link.
-
BOT_TOKEN_HERE: The bot token obtained at Step 2. -
BOT_CLIENT_ID_HERE: The ID of your application. You can obtain it by following the instructions in parentheses in Step 3-2. -
BOT_ADMIN_ID_HERE: The ID of the user responsible for managing the bot. It will be used to grant this user exclusive access to sensitive commands. -
CONTROLLER_ROLE_ID_HERE: The ID of the role that grants access to reviewing submissions with the bot. -
GRANTED_ROLE_ID_HERE: The ID of the role that is granted to an applicant when their submission is approved. -
BLACKLIST_ROLE_ID_HERE: The ID of the role that restricts any applicant who has it from using the/submitcommand. -
SUBMISSIONS_CHANNEL_ID_HERE: The ID of the channel where submissions arrive and are reviewed. It is also the channel where applicants are notified whether their submission has been approved/rejected. -
GRANTED_CHANNEL_ID_HERE: The ID of the channel that is granted to an applicant when their submission is approved. -
LOGS_CHANNEL_ID_HERE: Optional (erase the whole line if you do not want the bot to log certain actions). The ID of the channel where the bot will log certain actions, such as submissions approvals and rejections. -
DEMO_KEY: Optional (leave as DEMO_KEY if you do not have one). Your API key for https://api.nasa.gov.
In the main directory of the bot's code, open a terminal, type npm install and press enter. Wait for all packages to be installed. If the installation was successfull, you shoud see a message like this in the terminal:
added X packages, and audited X packages in Xs
X packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
In the same terminal, type node deploy-commands.js and press enter. If the deployment was successfull, you shoud see a message like this in the terminal:
[INFO] Successfully reloaded X application (/) commands.
In the same terminal, type node index.js and press enter. A message like this should then appear in the terminal:
[INFO] Bot ready! Logged in as X.
If you see this message, congratulations! Your bot is now running and ready to use in your server. If not, you can try reading the error message and seeing what went wrong. Reminder: for most cases, internet is your best friend!
Warning
If you close the terminal window or shut down your computer, your bot will also go offline. You will then have to re-open a terminal in the main directory of the bot's code and run node index.js again. If you want your bot to be permanently running, consider the following options:
- Only run your bot when you are using your computer: This option is free and the easiest to set up, but can be unconvenient for people who live in different time zones or who do not have the same working hours as you. Additionally, keeping your computer powered and running 24/7 is NOT recommended.
- Run your bot from a personal server: If you already posess/have access to a server that's permanently operating, you can try adding QCBot to it. In its current state, QCBot does not consume a lot of resources under normal operation conditions.
- Rent a virtual machine: Plenty of companies offer hosting options or access to virtual machines (VMs) at a reasonable price. If you go for this, make sure to choose a solution that fits your needs.