Documentation
Everything you need to deploy and manage your Discord bots on BotHost.
Quick Start
Welcome to BotHost! This guide will walk you through deploying your first Discord bot in minutes.
- Create an account on BotHost and log in to your dashboard.
- Create a new bot by clicking "New Bot" and choose your language (Python or Node.js).
- Upload your files via the interface or connect your GitHub repository.
- Configure your environment variables (TOKEN, etc.).
- Deploy and your bot is online!
You can try for free for 7 days with our Starter plan, no credit card required!
Create a Discord Bot
Before deploying on BotHost, you need to create a Discord application:
- Go to the Discord Developer Portal.
- Click "New Application" and give your bot a name.
- Go to the "Bot" tab and click "Add Bot".
- Copy your bot's Token (keep it secret!).
- In "OAuth2 > URL Generator", select the required scopes and permissions.
- Use the generated URL to invite the bot to your server.
Never share your token! If your token is compromised, regenerate it immediately on the Developer Portal.
Deploy Your Bot
Once your files are ready, here's how to deploy them on BotHost:
Via the web interface
- Go to your bot in the dashboard.
- Click "Files" then "Upload".
- Select your files or drag and drop them.
- Click "Deploy".
Via GitHub (recommended)
- Connect your GitHub account in settings.
- Select your repository and branch.
- Enable automatic deployment (optional).
- Each push will trigger a new deployment.
Python Bots
BotHost supports Python 3.10+ with major Discord libraries.
Recommended structure
# Structure de fichiers
my-bot/
├── main.py # Point d'entrée
├── requirements.txt # Dépendances
├── cogs/ # Commandes (optionnel)
└── utils/ # Utilitaires (optionnel)
requirements.txt
discord.py>=2.0.0
python-dotenv
aiohttp
Exemple de bot
import discord
from discord.ext import commands
import os
bot = commands.Bot(
command_prefix="!",
intents=discord.Intents.all()
)
@bot.event
async def on_ready():
print(f"✅ Connecté en tant que {bot.user}")
@bot.command()
async def ping(ctx):
await ctx.send(f"🏓 Pong! {round(bot.latency * 1000)}ms")
bot.run(os.getenv("DISCORD_TOKEN"))
Node.js Bots
BotHost supports Node.js 18+ with discord.js v14.
Recommended structure
# Structure de fichiers
my-bot/
├── index.js # Point d'entrée
├── package.json # Dépendances
├── commands/ # Commandes slash
└── events/ # Événements
package.json
{
"name": "my-discord-bot",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"discord.js": "^14.0.0",
"dotenv": "^16.0.0"
}
}
Exemple de bot
const { Client, GatewayIntentBits } = require('discord.js');
require('dotenv').config();
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
});
client.on('ready', () => {
console.log(`✅ Connecté en tant que ${client.user.tag}`);
});
client.on('messageCreate', async (message) => {
if (message.content === '!ping') {
await message.reply(`🏓 Pong! ${client.ws.ping}ms`);
}
});
client.login(process.env.DISCORD_TOKEN);
Environment Variables
Environment variables allow you to securely store sensitive data like your Discord token.
Add variables
- Go to your bot in the dashboard.
- Click "Settings" then "Environment Variables".
- Add your variables (key/value).
- Redeploy your bot to apply changes.
DISCORD_TOKEN - Your Discord bot token
PREFIX - Command prefix (!)
DATABASE_URL - Database connection URL
Logs & Monitoring
Monitor your bot's activity in real time with logs.
Access logs
- Open your bot's dashboard.
- Click on the "Logs" tab.
- Logs are displayed in real time.
Best practices
- Use
print()in Python orconsole.log()in JS for debugging. - Avoid logging sensitive information (tokens, passwords).
- Use prefixes to differentiate log types ([INFO], [ERROR], etc.).
Troubleshooting
Here are the most common issues and their solutions:
❌ My bot won't start
- Check that the main file is properly named (main.py or index.js).
- Check that DISCORD_TOKEN is configured in environment variables.
- Check the logs to identify the error.
❌ "Token invalid" error
- Verify that the token is correct and complete.
- Regenerate the token on the Discord Developer Portal if needed.
- Make sure there are no extra spaces or characters.
❌ Bot disconnects frequently
- Check that you haven't exceeded your plan's resource limits.
- Optimize your code to reduce memory usage.
- Consider upgrading to a higher plan.
❌ Dependencies won't install
- Check the syntax of your requirements.txt or package.json.
- Make sure versions are compatible.
- Try specifying exact versions.
If you can't find the solution to your problem, feel free to contact our support or join our Discord server.