Here's a solid blueprint for an OwO-style economy bot with canvas-generated image cards.
Tech stack discord.js v14 (or Eris) node-canvas or @napi-rs/canvas (faster) for image rendering MongoDB or SQLite/Postgres for player data node-cron for daily resets/passive income Core economy loop Currency: 2 tiers work well โ "coins" (common, earned fast) and "gems" (rare, premium/gacha) daily / weekly โ streak bonuses to encourage retention work โ random job flavor text + payout, cooldown 30-60min beg โ small payout, short cooldown, low risk crime / rob โ risk/reward, chance to fail and lose coins or go to "jail" (temporary cooldown lock) gamble / slots / blackjack / coinflip โ coin sinks with house edge Progression systems inventory โ items, boxes, materials shop / buy / sell โ rotating or static shop pets or battle โ collectible mechanic with rarity tiers (common โ mythical), driven by canvas-rendered cards craft โ combine materials into rare items market / trade โ player-to-player trading or auction house Canvas image cards (the OwO-style visual hook) Pet/item pull cards: background by rarity color, sprite image, name, stats overlay profile card: avatar, level bar, balance, badges leaderboard card: top 10 with avatars pulled via loadImage(user.displayAvatarURL()) Cache generated backgrounds/frames as static PNGs, composite dynamic text/avatar on top each call โ much faster than redrawing everything Command categories for "full quality" | Category | Examples | |---|---| | Economy | balance, daily, work, rob, gamble, deposit/withdraw (bank) | | Collection | hunt, catch, pets, battle, evolve | | Shop/Items | shop, buy, sell, inventory, use | | Social | profile, leaderboard, marry/trade (optional) | | Utility | help, settings, cooldowns | | Admin | give/take (mod only), reset, config | Anti-abuse essentials Server-side cooldowns (Redis or in-memory Map) โ never trust client timing Rate-limit rob/gamble per user Log large transactions for anti-cheat auditing
How deployed in host but want a free host
For a Discord bot, use a host that can run a Node.js process continuously. Static hosting such as GitHub Pages or Netlify will not work.
Best free option: Oracle Cloud Always Free VPS
Oracle provides an always-free virtual machine suitable for a small Discord bot. The setup is more technical, but it supports 24/7 uptime and persistent SQLite data.
1. Create the server
Create an account at cloud.oracle.com.
Create a free Ubuntu instance.
Choose an Always Free shape.
Save the SSH private key.
Copy the serverโs public IP address.
2. Connect through SSH
ssh ubuntu@YOUR_SERVER_IP
3. Install Node.js and Git
sudo apt update
sudo apt install -y git curl
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
node --version
npm --version
4. Upload your bot
If your project is on GitHub:
git clone https://github.com/YOUR_USERNAME/YOUR_REPOSITORY.git
cd YOUR_REPOSITORY
npm install
If it is not on GitHub, upload the project with SCP:
scp -r ./KodariEconomyBot ubuntu@YOUR_SERVER_IP:/home/ubuntu/
Then connect and run:
cd KodariEconomyBot
npm install
5. Add your environment variables
cp .env.example .env
nano .env
Add your Discord token:
DISCORD_TOKEN=your_discord_bot_token
CLIENT_ID=your_application_client_id
GUILD_ID=your_test_server_id
Never put the real token directly into GitHub.
6. Register slash commands
Run the command registration script once:
npm run register
If your package.json uses a different script name, run the corresponding registration command.
7. Keep the bot online
Install PM2:
sudo npm install -g pm2
Start the bot:
pm2 start index.js --name kodari-economy
pm2 save
pm2 startup
Run the command printed by pm2 startup, then check the bot:
pm2 status
pm2 logs kodari-economy
The bot will automatically restart if it crashes or if the server reboots.
Easier free alternatives
Host | Ease | 24/7 reliability | Notes |
|---|---|---|---|
Oracle Cloud Always Free | Medium | Good | Best for persistent SQLite bots |
Koyeb | Easy | Depends on current free plan | Connects directly to GitHub |
Render | Easy | Limited | Free services may sleep |
Replit | Very easy | Limited | Usually sleeps unless paid or externally kept awake |
Railway | Easy | Trial/limited | Free credits and plans can change |
For this bot, avoid hosts that delete the filesystem on restart. Your SQLite database contains balances, inventory, cooldowns, and player data. If the host has temporary storage, the economy may reset.
Discord Developer Portal settings
In the botโs Discord Developer Portal:
Open Bot โ Reset Token if necessary and copy the token.
Enable Message Content Intent only if the bot uses message commands.
Generate an invite using these scopes:
botapplications.commands
Give it permissions such as:
View Channels
Send Messages
Embed Links
Attach Files
Use Slash Commands
For a free and reliable setup, I recommend Oracle Cloud + Ubuntu + PM2.
I want a create pterodactyl panel for discorf bot full setup
You can host your Discord bot on a Pterodactyl panel, but Pterodactyl itself must be installed on a VPS. The panel is not a free hosting service by itself.
Recommended free setup
Use:
Oracle Cloud Always Free VPS
Ubuntu 22.04 or 24.04
2โ4 GB RAM minimum
AMD64/x86 server recommended for canvas packages
A domain or subdomain such as
panel.example.comPterodactyl Panel
Pterodactyl Wings
Docker
Node.js Discord bot server
Oracle free instances can be difficult to obtain because of capacity limits. A paid VPS is usually easier and more reliable.
1. Prepare the VPS
Connect to the server:
ssh ubuntu@YOUR_SERVER_IP
Update Ubuntu:
sudo apt update && sudo apt upgrade -y
Set the hostname:
sudo hostnamectl set-hostname ptero
Install basic packages:
sudo apt install -y curl wget git unzip tar ca-certificates gnupg lsb-release ufw
Open the required firewall ports:
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 8080/tcp
sudo ufw allow 2022/tcp
sudo ufw enable
Also open ports 80, 443, and 2022 in the Oracle Cloud security rules.
2. Point your domain to the VPS
Create these DNS records:
panel.example.com A YOUR_SERVER_IP
node.example.com A YOUR_SERVER_IP
Wait for DNS propagation before configuring SSL.
You can test DNS with:
ping panel.example.com
3. Install Pterodactyl Panel
The official installation documentation is here:
The panel requires:
Nginx
PHP
MariaDB or MySQL
Redis
Composer
A queue worker
Cron
SSL certificate
For a first installation, use the official documentation rather than random YouTube scripts because unofficial installers can install outdated or unsafe packages.
The panel URL will eventually be:
https://panel.example.com
During the installation, create:
A database named
panelA database user such as
pterodactylA strong panel administrator account
An application encryption key
Your domain name
Important: save the encryption key securely. Losing it can make the panel data unusable.
4. Install Wings
Wings is the daemon that actually runs the Discord bot containers.
Install Docker:
curl -sSL https://get.docker.com | sudo bash
sudo systemctl enable --now docker
Create the Wings directory:
sudo mkdir -p /etc/pterodactyl
Download Wings according to the version shown in your Pterodactyl panel. The official Wings documentation is:
Check that Wings is installed:
sudo wings --version
5. Create a node in Pterodactyl
Log in to your panel as administrator.
Go to:
Admin Panel โ Locations
Create a location, for example:
Name: Oracle
Short code: oracle
Then go to:
Admin Panel โ Nodes โ Create New
Use values similar to:
Name: Oracle Node
Location: Oracle
FQDN: node.example.com
Scheme: https
Daemon Port: 8080
SFTP Port: 2022
Set memory and disk limits based on your VPS.
For example, on a VPS with 4 GB RAM:
Memory: 3500 MB
Disk: 20000 MB
Do not allocate all VPS memory to the bot. Leave some memory for Ubuntu, Docker, and the panel.
6. Configure Wings
After creating the node, open:
Admin Panel โ Nodes โ Oracle Node โ Configuration
Copy the generated configuration.
Create the configuration file:
sudo nano /etc/pterodactyl/config.yml
Paste the node configuration and save it.
Create a systemd service:
sudo nano /etc/systemd/system/wings.service
Add:
[Unit]
Description=Pterodactyl Wings Daemon
After=docker.service
Requires=docker.service
[Service]
User=root
WorkingDirectory=/etc/pterodactyl
LimitNOFILE=4096
PIDFile=/var/run/wings/daemon.pid
ExecStart=/usr/local/bin/wings
Restart=on-failure
StartLimitInterval=180
StartLimitBurst=30
[Install]
WantedBy=multi-user.target
Enable Wings:
sudo systemctl daemon-reload
sudo systemctl enable --now wings
Check the status:
sudo systemctl status wings
View logs:
sudo journalctl -u wings -f
The node should show as Connected in the Pterodactyl panel.
7. Install the Node.js egg
For your Discord bot, use a Node.js Docker image.
In the panel, go to:
Admin Panel โ Nests
You can import the official Node.js egg from the Pterodactyl Discord or Node.js egg repository. Alternatively, create a simple custom egg using a Node.js Docker image.
Recommended image:
ghcr.io/parkervcp/yolks:nodejs_20
Use Node.js 20 because most discord.js v14 projects support it.
Your server startup command should be:
npm install && npm start
If your package.json does not contain a start script, use:
npm install && node index.js
A suitable package.json script is:
{
"scripts": {
"start": "node index.js",
"register": "node src/register-commands.js"
}
}
8. Create the Discord bot server
In Pterodactyl:
Servers โ Create New
Select:
Node: Oracle Node
Nest: Node.js
Egg: Node.js
Use:
Name: Kodari Economy Bot
Owner: your panel account
Memory: 1024โ2048 MB
Disk: 5000โ10000 MB
CPU: 100%
A Discord bot normally does not need a public network port. If Pterodactyl requires an allocation, create one but do not make your bot listen publicly.
9. Upload the bot
You have several options.
GitHub method
In the Pterodactyl console:
git clone https://github.com/YOUR_USERNAME/YOUR_REPOSITORY.git .
npm install
Do not upload your real .env file to GitHub.
SFTP method
Use an SFTP client such as:
FileZilla
WinSCP
Cyberduck
Connection details:
Host: node.example.com
Port: 2022
Username: panel_username.server_identifier
Password: your_panel_password
Protocol: SFTP
Upload:
index.js
package.json
package-lock.json
src/
Do not upload:
node_modules/
.env
Run npm install inside the Pterodactyl server instead.
10. Add bot environment variables
In the Pterodactyl server, open:
Startup โ Variables
Add:
DISCORD_TOKEN=your_discord_bot_token
CLIENT_ID=your_discord_application_id
GUILD_ID=your_test_server_id
If your bot uses SQLite, also add any database path expected by your code, for example:
DATABASE_PATH=data/economy.sqlite
Then create the data directory in the console:
mkdir -p data
Your .env file should not be committed to GitHub.
Example local .env:
DISCORD_TOKEN=replace_with_your_token
CLIENT_ID=replace_with_client_id
GUILD_ID=replace_with_server_id
DATABASE_PATH=data/economy.sqlite
Never share the Discord token. If it is exposed, immediately reset it in the Discord Developer Portal.
11. Register slash commands
Start the server once and install dependencies:
npm install
Then register commands:
npm run register
For fast testing, use GUILD_ID. Guild commands update almost immediately.
After commands are working, you can register global commands by removing the guild-specific registration code. Global commands may take time to appear.
Start the bot:
npm start
Or use the Pterodactyl consoleโs Start button.
12. Recommended server settings
Set the following in Pterodactyl:
Restart Behavior: Always
Auto Allocate Ports: Disabled
OOM Killer: Enabled
For a small economy bot:
RAM: 1024 MB
Disk: 5 GB
CPU: 100%
If you use canvas image generation, increase memory:
RAM: 2048 MB
Canvas libraries can require additional native dependencies. @napi-rs/canvas is usually easier than node-canvas because it generally avoids compiling Cairo and Pango during installation.
Use:
npm install @napi-rs/canvas
instead of canvas if your project supports it.
13. SQLite persistence
SQLite works on Pterodactyl as long as the serverโs disk is persistent.
Store the database inside the server directory:
/data/economy.sqlite
Back it up regularly. From the Pterodactyl console:
mkdir -p backups
cp data/economy.sqlite backups/economy-$(date +%F).sqlite
For a larger bot, use MariaDB or PostgreSQL instead of SQLite.
Do not store the database in:
/tmp
Temporary directories may be cleared.
14. Create a backup
In the Pterodactyl panel:
Server โ Backups โ Create Backup
Schedule regular backups if your panel configuration supports it.
Back up at least:
data/economy.sqlite
config files
package.json
src/
The Discord token should not be included in public backups.
15. Common problems
Bot immediately stops
Check the console:
npm start
Typical causes:
Missing
DISCORD_TOKENIncorrect start command
Missing dependency
Wrong Node.js version
JavaScript syntax error
Slash commands do not appear
Check:
CLIENT_IDGUILD_IDBot was invited with
applications.commandsRegistration command completed successfully
Canvas installation fails
Prefer:
npm uninstall canvas
npm install @napi-rs/canvas
Also ensure the server uses AMD64 rather than ARM64 if the package does not provide a compatible binary.
Wings is offline
Check:
sudo systemctl status wings
sudo journalctl -u wings -n 100
Also verify:
DNS for
node.example.comPort
8080Port
2022SSL certificate
/etc/pterodactyl/config.yml
Panel cannot connect to the node
The nodeโs FQDN must resolve to the VPS IP:
node.example.com โ VPS IP
Do not use localhost as the node FQDN when the panel and Wings are configured through a domain.
Final architecture
Discord
โ
Discord bot process
โ
Pterodactyl server container
โ
Wings
โ
Docker
โ
Ubuntu VPS
For your economy bot, the simplest stable deployment is:
Pterodactyl
Node.js 20 egg
npm install && npm start
@discordjs
@napi-rs/canvas
SQLite in data/economy.sqlite
Automatic restart enabled
Scheduled Pterodactyl backups
Pterodactyl requires a VPS with root access. If you do not have a VPS, the easiest free alternative is to run the bot directly on Oracle Cloud Always Free rather than installing the full panel.
require('dotenv').config();
const { Client, GatewayIntentBits, REST, Routes } = require('discord.js');
const config = require('./src/config');
const Database = require('./src/database');
const Economy = require('./src/economy');
const { commands, handleInteraction } = require('./src/commands');
if (!config.token || !config.clientId) {
console.error('DISCORD_TOKEN and DISCORD_CLIENT_ID must be set in .env');
process.exit(1);
}
const client = new Client({
intents: [GatewayIntentBits.Guilds]
});
const database = new Database(config.databasePath);
const economy = new Economy(database);
async function registerCommands() {
const rest = new REST({ version: '10' }).setToken(config.token);
const route = config.guildId
? Routes.applicationGuildCommands(config.clientId, config.guildId)
: Routes.applicationCommands(config.clientId);
await rest.put(route, { body: commands });
console.log(`Registered ${commands.length} slash commands.`);
}
client.once('ready', async () => {
console.log(`Bot is ready as ${client.user.tag}`);
try {
await registerCommands();
} catch (error) {
console.error('Failed to register slash commands:', error);
}
});
client.on('interactionCreate', async interaction => {
if (!interaction.isChatInputCommand()) {
return;
}
try {
await handleInteraction(interaction, economy);
} catch (error) {
console.error(`Command ${interaction.commandName} failed:`, error);
const response = {
content: 'Something went wrong while processing that command.',
ephemeral: true
};
if (interaction.replied || interaction.deferred) {
await interaction.editReply(response).catch(() => {});
} else {
await interaction.reply(response).catch(() => {});
}
}
});
client.on('error', error => {
console.error('Discord client error:', error);
});
process.on('SIGINT', () => {
database.close();
client.destroy();
process.exit(0);
});
process.on('SIGTERM', () => {
database.close();
client.destroy();
process.exit(0);
});
client.login(config.token).catch(error => {
console.error('Failed to log in:', error);
process.exit(1);
});