Reddit

Free Reddit bot hosting.

Reply bots, moderation helpers, flair and wiki maintenance, feeds from Reddit to somewhere else. Your loop keeps running when your laptop lid closes.

Choose a runtime

Pick your language

All three are installed and tested. Each page covers the libraries, the deployment and what fits in 256 MB for that runtime specifically.

Every Reddit bot is a polling loop

Reddit does not push anything to a bot. There is no gateway to connect to and no webhook to register: your bot asks the API for new posts, comments or messages, handles what came back, waits, and asks again. The libraries wrap that as a "stream", but underneath it is a loop.

That is good news on a free allocation. A loop that makes a request every few seconds uses a sliver of 25% of a core, needs no domain or open port, and is exactly the kind of long-running process this is built for.

Remember what you have already answered

This is what separates a bot moderators tolerate from one they ban. When a stream starts, it hands you the most recent items as well as new ones. A bot that keeps its list of handled IDs in memory forgets it on every restart, and then replies to the same posts a second time.

Your 512 MB of disk persists across restarts, crashes and redeploys. Write each handled ID to a SQLite file or a plain text file before you act on it, check it before you reply, and a restart is invisible to everybody reading the thread.

Get API access sorted before you write code

A Reddit bot needs an app registered against a Reddit account, which gives you a client ID and secret, and it needs a descriptive user agent naming the bot and who runs it. Reddit's rules on who gets API access, and for what, have changed more than once, so read the current developer terms before you build rather than after.

The API is rate limited per app. The libraries below track the limit from Reddit's own response headers and slow down for you; code that talks to the API directly has to do the same.

Subreddit rules come before ours

Many subreddits ban bots outright, and most ban ones that reply without being asked. Get a moderator's permission before your bot posts somewhere, or have it only reply when summoned by name. That is the difference between a useful bot and a banned account.

Our acceptable use policy forbids spam in the usual sense, and a reply bot that answers every post containing a keyword is spam by any reading.

FAQ

Questions

Do I need a domain or a public URL?

No. A Reddit bot only makes outbound requests to Reddit's API. Nothing needs to reach it from the internet.

Why is my bot replying twice to the same post?

Because it restarted and forgot what it had done. Streams replay recent items when they start. Persist the IDs you have handled to a file, check before replying, and the duplicates stop.

Can my bot moderate a subreddit?

Yes, if the account it logs in as is a moderator there with the permissions the task needs. Removing posts, approving them, setting flair and updating the wiki are all ordinary API calls from a moderator account.

Where do the credentials go?

Client ID, client secret, username and password all go into environment variables on your server here, never into a file you might share or commit. Use a separate Reddit account for the bot rather than your own.

Python, Node.js, Bun or Ruby for a Reddit bot?

Python, unless you have a reason not to. PRAW is the most mature Reddit library in any language and most Reddit bot examples use it. Node.js, Bun and Ruby work fine, but you will be closer to the raw API.