Introduction
To develop and host a Discord bot on Square Cloud, it’s essential to follow a structured sequence of configurations and prerequisites. This technical guide will cover the entire process, from initial setup to production deployment.Essential Prerequisites
- Active Discord Account: Fundamental for creating and managing bots on the platform. If you don’t have one, visit the official Discord website to create your account.
- Square Cloud Account: Hosting platform for your application. Register through the signup page using your email.
- Active Paid Plan: Ensures dedicated resources and optimized performance for your bot. Check our available plans and choose the most suitable for your needs.
Initial Discord Bot Configuration
Application Creation
Access the Developer Portal and click “New Application”. Define a name for your bot and click “Create” to create the application.

Authentication Token Generation
After creating the application, navigate to the “Bot” tab and click “Reset Token” to generate the authentication token. Copy the generated token for later use in code implementation.

Privileged Intents Activation
With the token configured, activate the necessary intents. Stay in the “Bot” tab, scroll down and locate “Privileged Gateway Intents”. Activate the intents as shown in the image:

Critical Security: Keep your bot token in absolute secrecy. This token grants total control over the bot and should be treated as confidential information.
Bot Development
Recommended Libraries and Frameworks
Node.js Environment Setup
- Verify that Node.js is installed on your system. If not, download it from the official Node.js website.
- Initialize a new Node.js project:
Terminal
- Install the Discord.js library:
Terminal
- Create a JavaScript file (e.g.,
index.js
) and add the following code to create a basic Discord bot:
index.js
Square Cloud Configuration File
Learn about: how to create the configuration file for Square Cloud.
The squarecloud.app file is a configuration file that will be used to configure your application on Square Cloud. It defines name, description, version, main file, among other essential configurations.
START Field Configuration
Only use this field if you are absolutely sure about what you are doing.
Uploading Your Project to Square Cloud
After following all the steps, package your application files into a zip file where the configuration file is located and upload the bot at Upload. Remember to include therequirements.txt
or package.json
file, but do not include files like __pycache__
or node_modules
. You can get more information about unnecessary files during hosting at automatic-file-deletion-when-deploying-an-application-on-squarecloud.
Testing the Bot
If you followed all the steps correctly, the next step is to invite your bot for testing. To do this, follow these steps:- Access the Developer Portal.
- Select your bot.
- Navigate to the “OAuth2” tab.
- Go to “OAuth2 URL Generator”.
- Check the “bot” option.
- Choose the permissions your bot will have when invited using this invite.
- Below the permissions, an invite link for your bot will be generated. It should look like this:
client_id
in the URL should be replaced with your bot’s actual ID. The permissions
value may also need to be adjusted based on the permissions you want your bot to have.
Now, to test if everything is working, execute the following command on your server: !hello
.
