Recap of DigitalOcean Scrib Bot Setup – fully written by Grok
- Initial Updates
We updated the Droplet to ensure the system had the latest packages and security updates.
apt update
apt upgrade -y
What This Did: Fetched the latest package lists and upgraded all installed packages.
- Download Python, pip, and Other Packages
We ensured Python 3 was available, installed pip, set up a virtual environment, and installed necessary Python libraries (tweepy, feedparser, python-dotenv, requests, beautifulsoup4).
python3 –version
apt install python3-pip python3-venv -y
python3 -m venv venv
source venv/bin/activate
pip install tweepy feedparser python-dotenv requests beautifulsoup4
pip list | grep -E ‘tweepy|feedparser|python-dotenv|requests|beautifulsoup4’
What This Did: Confirmed Python 3, installed pip and venv, created a virtual environment, and installed libraries for X API, RSS parsing, environment variables, HTTP requests, and web scraping.
- New Directory and the Files Included
We created a directory for the bot’s files, set up environment variables, and created multiple script versions.
mkdir scrib-bot
cd scrib-bot
python3 -m venv venv
source venv/bin/activate
nano .env
nano scrib_to_x_vps.py
nano scrib_to_x_vps_ver2.py
nano scrib_to_x_vps_ver3.py
ls
Files Included: venv/ (virtual environment), .env (X API keys), scrib_to_x_vps.py (initial script), scrib_to_x_vps_ver2.py (tweets only text), scrib_to_x_vps_ver3.py (added persistence), scrib_to_x_ver3.log (log file), last_entry_id_ver3.txt (stores last entry ID).
What This Did: Organized files in /root/scrib-bot and iterated on the script for improved functionality.
- What Is tmux?
tmux is a terminal multiplexer that lets your script run in a detachable session, continuing even after closing the Droplet Console.
Commands:
apt update
apt install tmux -y
tmux new -s scribt-bot
tmux rename-session -t scribt-bot scrib-bot
cd /root/scrib-bot
source venv/bin/activate
python3 scrib_to_x_vps_ver3.py
Inside tmux, detach with: Ctrl+B, release, then D
tmux list-sessions
tmux attach -t scrib-bot
What tmux Does: Runs your script in a background session (scrib-bot), allowing detachment and reattachment. Your script is currently running in this session.