Help & Tutorial

Everything you need to know to host your bots on NerdHosting

Quick Start Guide
1 Create Your Account

Sign up at Register Page with your email and choose a username.

2 Prepare Your Bot Repository

Your bot can be written in JavaScript, TypeScript, or Python!

Supported platforms: Discord 🎮, Bluesky 🦋, Telegram ✈️, Slack 💼, Twitch 🎥

JavaScript/Node.js:
  • package.json with a "start" script
  • Only approved npm packages
{ "name": "my-bot", "version": "1.0.0", "scripts": { "start": "node index.js" }, "dependencies": { "discord.js": "^14.0.0" } }
TypeScript:
  • package.json + tsconfig.json
  • Build script to compile TypeScript
Python:
  • requirements.txt with dependencies
  • main.py or bot.py as entry point
# requirements.txt discord.py==2.3.0 python-dotenv==1.0.0

Important: No hardcoded credentials - use environment variables!

3 Deploy Your Bot

From your Dashboard:

  1. Click "Deploy New Bot"
  2. Enter bot name and GitHub repository URL
  3. Choose bot type (Discord, Bluesky, Telegram, Slack, or Twitch)
  4. Choose execution mode:
    • 24/7 Persistent: Bot runs continuously (for Discord, Telegram chat bots)
    • Scheduled (Cron): Bot runs at specific intervals (for periodic tasks, minimum 20 minutes)
  5. If scheduled, pick a schedule: every 20 min, hourly, daily, etc.
  6. Add environment variables (API tokens, passwords, etc.)
  7. Click "Create Bot" - we'll clone and deploy it!
4 Manage Your Bot

Once deployed, you can:

  • Start/Stop your bot
  • Restart if needed
  • View real-time logs
  • Edit schedule (change execution mode or timing)
  • Update environment variables
  • Delete when done
Scheduled Bots: You'll see the next run time and execution count on your bot card!
Approved NPM Packages

For security, we only allow these npm packages:

Bot Frameworks:
discord.js
@atproto/api
telegraf
node-telegram-bot-api
grammy
@slack/bolt
@slack/web-api
slackbots
tmi.js
twitch-js
HTTP & APIs:
axios
node-fetch
got
superagent
ws
socket.io-client
Databases:
pg
mysql2
mongodb
mongoose
redis
sqlite3
Utilities:
lodash
moment
dayjs
uuid
validator
joi
dotenv
Security & Auth:
bcrypt
bcryptjs
jsonwebtoken
Need another package? Contact us and we'll review it for approval!
Security Guidelines
Your bot will be rejected if it contains:
  • File system access (fs module)
  • Shell commands (child_process, exec, spawn)
  • Code evaluation (eval(), Function() constructor)
  • Network server creation (http.createServer, net)
  • Unapproved npm packages
  • Obfuscated or suspicious code
Best Practices:
  • Use environment variables for all credentials
  • Keep your code clean and readable
  • Use only approved packages
  • Include proper error handling
  • Add logging to help with debugging
Scheduled Bots (Cron Jobs)

NerdHosting supports two execution modes for your bots:

24/7 Persistent Mode

Bot runs continuously, always online.

Best for:

  • Discord chat bots
  • Telegram message handlers
  • Real-time monitoring
  • Event-driven bots
Scheduled Mode (Cron)

Bot runs at specific intervals, then exits.

Best for:

  • Daily social media posts
  • Periodic data collection
  • Scheduled reports
  • Cleanup tasks
⏰ How Scheduled Bots Work

When you set a bot to scheduled mode:

  1. Your bot code runs at the scheduled time
  2. Bot completes its task (posts, fetches data, etc.)
  3. Bot exits naturally (no infinite loops needed!)
  4. Platform automatically restarts it at the next scheduled time
Minimum Interval: 20 Minutes
To prevent server abuse, scheduled bots cannot run more frequently than every 20 minutes.
📅 Schedule Presets (Easy Mode)

Choose from common presets in the dashboard:

⏰ Every 20 minutes
⏰ Every 30 minutes
⏰ Every hour
⏰ Every 2 hours
⏰ Every 6 hours
⏰ Every 12 hours
⏰ Once daily
🔧 Custom Cron Expressions (Advanced)

For advanced users, enter custom cron expressions:

# Format: minute hour day month weekday */20 * * * * # Every 20 minutes 0 * * * * # Every hour at minute 0 30 2 * * * # Daily at 2:30 AM 0 */6 * * * # Every 6 hours 0 9 * * 1 # Every Monday at 9 AM
💻 Scheduled Bot Code Example

Write code that runs once and exits (no setInterval or infinite loops!):

// Bluesky Daily Poster (JavaScript) const axios = require('axios'); async function main() { // Login to Bluesky const session = await axios.post('https://bsky.social/xrpc/com.atproto.server.createSession', { identifier: process.env.BSKY_USERNAME, password: process.env.BSKY_APP_PASSWORD }); // Post message await axios.post('https://bsky.social/xrpc/com.atproto.repo.createRecord', { repo: session.data.did, collection: 'app.bsky.feed.post', record: { $type: 'app.bsky.feed.post', text: `Daily update: ${new Date().toISOString()}`, createdAt: new Date().toISOString() } }, { headers: { Authorization: `Bearer ${session.data.accessJwt}` } }); console.log('Posted successfully!'); // Script exits here - platform will restart at next schedule } main();
# Python Data Collector (runs every hour) import os import requests from datetime import datetime def main(): # Fetch data from API response = requests.get('https://api.example.com/data') data = response.json() # Process and save print(f"Collected {len(data)} items at {datetime.now()}") # Exit naturally - will run again in 1 hour if __name__ == "__main__": main()
🎯 Do's and Don'ts for Scheduled Bots
✅ DO:
  • Write code that runs once and exits
  • Use async/await properly
  • Log your actions for debugging
  • Handle errors gracefully
❌ DON'T:
  • Use setInterval() or setTimeout()
  • Create infinite loops
  • Keep WebSocket connections open
  • Add event listeners that prevent exit
Tip: You can convert any existing bot between persistent and scheduled mode using the "Edit Schedule" button on your dashboard!
Example Bot Code
Discord Bot Example
const { Client, GatewayIntentBits } = require('discord.js'); const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent ] }); client.on('ready', () => { console.log(`Logged in as ${client.user.tag}`); }); client.on('messageCreate', message => { if (message.content === '!ping') { message.reply('Pong!'); } }); // Use environment variable from dashboard client.login(process.env.DISCORD_TOKEN);
Bluesky Bot Example
const { BskyAgent } = require('@atproto/api'); const agent = new BskyAgent({ service: 'https://bsky.social' }); async function main() { // Login with credentials from dashboard await agent.login({ identifier: process.env.BLUESKY_HANDLE, password: process.env.BLUESKY_APP_PASSWORD }); console.log('Bot is running!'); // Check notifications every 5 minutes setInterval(async () => { const notifs = await agent.listNotifications(); console.log(`New notifications: ${notifs.data.notifications.length}`); }, 300000); } main();
Telegram Bot Example
const { Telegraf } = require('telegraf'); const bot = new Telegraf(process.env.TELEGRAM_BOT_TOKEN); bot.start((ctx) => { ctx.reply('Welcome! I am your bot.'); }); bot.command('ping', (ctx) => { ctx.reply('Pong! 🏓'); }); bot.on('text', (ctx) => { console.log(`Message from ${ctx.from.username}: ${ctx.message.text}`); }); bot.launch(); console.log('Telegram bot is running!');
Slack Bot Example
const { App } = require('@slack/bolt'); const app = new App({ token: process.env.SLACK_BOT_TOKEN, signingSecret: process.env.SLACK_SIGNING_SECRET }); app.message('hello', async ({ message, say }) => { await say(`Hey there, <@${message.user}>!`); }); app.command('/ping', async ({ command, ack, respond }) => { await ack(); await respond('Pong! 🏓'); }); (async () => { await app.start(process.env.PORT || 3000); console.log('⚡️ Slack bot is running!'); })();
Twitch Bot Example
const tmi = require('tmi.js'); const client = new tmi.Client({ options: { debug: true }, identity: { username: process.env.TWITCH_USERNAME, password: process.env.TWITCH_OAUTH_TOKEN }, channels: [process.env.TWITCH_CHANNEL] }); client.connect(); client.on('message', (channel, tags, message, self) => { if (self) return; if (message.toLowerCase() === '!hello') { client.say(channel, `@${tags.username}, hello!`); } }); console.log('Twitch bot is running!');
Python Discord Bot Example
# main.py import discord import os from discord.ext import commands bot = commands.Bot(command_prefix='!', intents=discord.Intents.all()) @bot.event async def on_ready(): print(f'Logged in as {bot.user}') @bot.command() async def ping(ctx): await ctx.send('Pong! 🏓') @bot.command() async def hello(ctx): await ctx.send(f'Hello {ctx.author.mention}!') # Use environment variable from dashboard bot.run(os.getenv('DISCORD_TOKEN'))
Multi-language Support! You can use JavaScript, TypeScript, or Python for your bots. We automatically detect the language and install the right dependencies.
Frequently Asked Questions
Q: How many bots can I host?
A: Currently 10 bots per user. Need more? Contact us!
Q: Can I use private GitHub repositories?
A: Not yet, but we're working on GitHub authentication for private repos.
Q: My bot keeps crashing, what should I do?
A: Check the logs in your dashboard. Common issues: missing environment variables, invalid credentials, or unhandled errors in your code.
Q: How do I update my bot's code?
A: Currently, you need to delete the bot and redeploy. We're working on a "pull & restart" feature!
Q: Why was my bot rejected during deployment?
A: Check for security issues - file system access, shell commands, eval(), or unapproved packages. The error message will tell you what was detected.
Q: Can I connect to external databases?
A: Yes! Use the approved database packages (pg, mysql2, mongodb, redis) and store connection strings in environment variables.
Q: What's the difference between persistent and scheduled bots?
A: Persistent bots run 24/7 (great for Discord chat bots). Scheduled bots run at specific intervals like every hour or daily (great for automated posts or data collection).
Q: Can I run a scheduled bot every 5 minutes?
A: No, the minimum interval is 20 minutes to prevent server abuse. You can run bots every 20 min, 30 min, hourly, or longer.
Q: How do I change my bot from persistent to scheduled?
A: Click the "Edit Schedule" button on your bot card, select "Scheduled" mode, pick your schedule, and save!
Q: My scheduled bot shows "stopped" - is it broken?
A: No! Scheduled bots show "stopped" while waiting for the next run. Check the "Next run" time on your bot card to see when it will execute.
Q: Can I use both JavaScript and Python bots?
A: Yes! We support JavaScript, TypeScript, and Python. We automatically detect your language and install the right dependencies.
Q: Is this service free?
A: Currently yes! We may introduce premium tiers in the future with more resources and features.