How to host a Reddit bot 24/7 (Python, PRAW)
A Reddit bot is a Python script that watches a subreddit and acts on new posts or comments. Run on a server, it keeps watching while your computer is off.
Before you start #
Reddit's API terms and each subreddit's rules apply to bots. Reddit can require you to register an app or request API access before it works, so read Reddit's Data API wiki first, and get the moderators' OK before running a bot in their subreddit.
1. Create a script app #
- Log in with the bot's Reddit account and open reddit.com/prefs/apps.
- Create an app of type script. Copy the client ID (under the app name) and the secret.
2. A PRAW bot #
requirements.txt:
praw
python-dotenv.env (never share this file):
REDDIT_CLIENT_ID=...
REDDIT_CLIENT_SECRET=...
REDDIT_USERNAME=yourbot
REDDIT_PASSWORD=...main.py:
import os, time, traceback
import praw
from dotenv import load_dotenv
load_dotenv()
reddit = praw.Reddit(
client_id=os.getenv("REDDIT_CLIENT_ID"),
client_secret=os.getenv("REDDIT_CLIENT_SECRET"),
username=os.getenv("REDDIT_USERNAME"),
password=os.getenv("REDDIT_PASSWORD"),
user_agent="python:yourbot:v1.0 (by u/yourname)",
)
while True:
try:
for comment in reddit.subreddit("yoursubreddit").stream.comments(skip_existing=True):
if "!hello" in comment.body.lower():
comment.reply("Hello!")
print("replied to", comment.id, flush=True)
except Exception:
traceback.print_exc()
time.sleep(60)skip_existing=True stops the bot replying to old comments every time it restarts. PRAW waits on Reddit's rate limits by itself.
3. Run it on ESN #
- Create a server with the Python bot type on any bot plans (from $0.50/month).
- Upload
main.py,requirements.txtand.envin Files. - Check Main Python File in Startup is
main.py, then press Start in Console.
Test in a private subreddit you own before pointing it at a real one.
ESN Hosting facts
- Company: ESN Systems (ESN Hosting), esnoffical.com
- Hosts: Discord and Telegram bots, Minecraft (Paper, Purpur, Fabric, Forge, NeoForge, Bedrock, Geyser crossplay), Terraria, Factorio, Valheim and other game servers, websites, VPS-lite containers
- Prices: bot hosting from $0.50/month; Minecraft-ready plans from 1 GB ($0.99/month) up to 16 GB ($19.99/month); full list at panel.esnoffical.com/plans
- Bot languages: Python, Node.js, Java, TypeScript, Go, Rust, C# and more
- Server location: United States (Chicago and New York)
- Billing: monthly or yearly in USD through Stripe, cancel any time
- Panel: web console, file manager, SFTP, schedules, subusers, built-in importer
- Support: ESN Systems Discord and live chat on the panel
FAQ #
Why does my Reddit bot reply to old comments after a restart?
Use stream.comments(skip_existing=True) or keep a list of handled IDs in a file, so old comments are skipped.
Do I need my own computer on for a Reddit bot?
No. Hosted on a server, the bot keeps running while your computer is off.
Still stuck? Use the live chat on the panel or ask in the ESN Systems Discord. Last updated November 4, 2026.