A lightweight presence bot for NyoChat. It logs in with your credentials and pings the homepage at a fixed interval (default: every 60 seconds) to keep your account looking active.
- On startup, the script performs a standard form login against
POST /login, attempting to extract and submit a CSRF token found in the page (<meta name="csrf-token">or a hiddencsrf_tokeninput). - It reuses a
requests.Session, so cookies (and therefore the authenticated session) persist across requests. - Every
NYOBOT_INTERVALseconds, it issues aGET /to keep the session alive and simulate presence.
No scheduler, headless browser, or external service is used — it's a single long-running Python process.
- Python 3.9+
- A NyoChat account
- (Optional) a Raspberry Pi or any always-on Linux machine, if you want this to run continuously
git clone <https://github.com/Redst0neX/NyoBot/>
cd nyobot
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# then edit .env with your credentialsAll configuration is done via environment variables, loaded from .env
(see .env.example):
| Variable | Required | Default | Description |
|---|---|---|---|
NYOCHAT_USERNAME |
yes | — | Your NyoChat username |
NYOCHAT_PASSWORD |
yes | — | Your NyoChat password |
NYOBOT_INTERVAL |
no | 60 |
Seconds between each homepage ping |
.env is git-ignored — never commit it. .env.example contains placeholders
only and is safe to version.
python3 nyobot.pyThe script logs to stdout:
2026-10-10 10:00:00 [INFO] Login succeeded (https://nyochat.fr/login -> https://nyochat.fr/)
2026-10-10 10:00:00 [INFO] NyoBot started, pinging every 60 seconds.
2026-10-10 10:01:00 [INFO] Ping OK (status=200)
Stop with Ctrl+C.
A sample unit file is provided in nyobot.service. Adjust User,
WorkingDirectory and ExecStart to match your install path (and point
ExecStart at your virtualenv's Python if you used one):
sudo cp nyobot.service /etc/systemd/system/nyobot.service
sudo systemctl daemon-reload
sudo systemctl enable --now nyobot
# check status / logs
sudo systemctl status nyobot
journalctl -u nyobot -fThe unit restarts the process automatically on failure (Restart=on-failure,
15s backoff).
nyobot/
├── nyobot.py # main script
├── requirements.txt # Python dependencies
├── .env.example # credential template (safe to commit)
├── .gitignore # excludes .env, venv/, __pycache__
├── nyobot.service # systemd unit template
└── README.md
- Login form field names are inferred, not scraped from a verified DOM
structure (
username,password,csrf_token). NyoChat is built on SocialPlace, so field names should be close to Flask/Django conventions, but if login fails:- Open
https://nyochat.fr/loginin a browser and inspect the form inputs'nameattributes. - Check the Network tab for the actual
POSTpayload on submit. - Update the
payloaddict inlogin()innyobot.pyaccordingly.
- Open
- No retry/backoff logic beyond the systemd-level restart — a failed ping is logged and the loop continues; a failed login at startup exits the process.
- No support for 2FA/CAPTCHA login flows.
- Credentials are read from environment variables only, never hardcoded.
- The script only talks to
nyochat.fr— no third-party requests, no telemetry. - Treat
.envlike a password: don't share it, don't commit it.
PRs welcome — in particular, a confirmed/verified login payload (exact field
names) would let the heuristics in get_csrf_token() / login() be
simplified.
MIT.