MemeBot is an autonomous agent that posts memes to X (Twitter) on a schedule.
It is built for resilient, continuous operation with logging, retry handling, and configurable meme sources.
This repository ships a production-ready baseline you can run locally or deploy to a VM/container.
MemeBot exists to automate meme publishing reliably and transparently:
- Fetch meme content from configurable sources (Imgflip and Reddit JSON feeds).
- Post to X every hour using Twitter API v2.
- Persist structured post logs to disk for auditing and analytics.
- Recover automatically from transient API and network failures.
MemeBot/
├── .env.example
├── requirements.txt
├── run.py
├── scripts/
│ └── post_counter.py
└── memebot/
├── __init__.py
├── bot.py
├── config.py
├── fetcher.py
├── post_logger.py
├── retry.py
└── twitter_client.py
- Python 3.10+
- X Developer account and API v2 credentials
- Clone repository and enter project directory.
- Create and activate a virtual environment.
- Install dependencies.
- Create
.envfrom.env.exampleand fill credentials.
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .envSet the following in .env:
TWITTER_BEARER_TOKENTWITTER_API_KEYTWITTER_API_SECRETTWITTER_ACCESS_TOKENTWITTER_ACCESS_TOKEN_SECRETPOST_INTERVAL_MINUTES(default60)MAX_RETRIES(default5)RETRY_BACKOFF_SECONDS(default2)POST_LOG_PATH(default./data/post_log.json)IMGFLIP_USERNAME/IMGFLIP_PASSWORD(optional)REDDIT_SUBREDDITS(comma-separated, default meme subs)REDDIT_USER_AGENT(optional)SOLANA_DONATION_WALLET(for README donation section)
python run.pyAt startup, MemeBot schedules an hourly job and executes one immediate post attempt so you can verify connectivity quickly.
MemeBot writes post history to POST_LOG_PATH. You can read a live post count with:
python scripts/post_counter.pyExpected output:
Total posts logged: 42
Successful posts: 39
Failed posts: 3
Each attempt is appended to JSON with fields:
timestampsourcememe_textmedia_urlstatus(successorfailed)tweet_iderror
To fund MemeBot infrastructure and legal support, set your wallet in .env:
SOLANA_DONATION_WALLET=REPLACE_WITH_YOUR_SOLANA_WALLET
Then display it publicly in your deployment docs or profile:
Donation Wallet (SOL): REPLACE_WITH_YOUR_SOLANA_WALLET
- Respect X automation rules and platform terms.
- Validate subreddit/source policies before deployment.
- For 24/7 uptime, run under a process manager (systemd, Docker restart policy, or supervisord).