Skip to content

Repository files navigation

Mopera

Mopera is a Telegram administration bot for Marzban and Marzneshin panels. It provides user, administrator, template, server, statistics, bulk-operation, QR-code, node-monitoring, and expiry-report workflows through Telegram.

Both sudo and regular panel accounts are supported. Available menus and actions follow the permissions granted by the connected panel. Panel URLs may include a reverse-proxy or dashboard path; omitted ports default to 443 for HTTPS and 80 for HTTP.

Requirements

  • PHP 8.1 or newer
  • cURL and CURLStringFile
  • PDO MySQL
  • JSON, ctype, and zlib extensions
  • GD only when QR backgrounds are enabled
  • MySQL or MariaDB with permission to create and alter tables

Installation

  1. Copy config.sample.php to config.php.
  2. Configure the Telegram token, administrator IDs, webhook URL, timezone, and MySQL connection.
  3. Point the Telegram webhook to index.php over HTTPS.
  4. Run the worker once per minute:
* * * * * /usr/bin/php /absolute/path/mopera/cron.php

A supervised process may run php cron.php --daemon instead. Use only one worker mode; MySQL advisory locks prevent overlapping runs.

Queue

Long panel scans and bulk changes use a persistent MySQL queue. Smaller operations run immediately. Statistics scan independent pages concurrently and checkpoint fetched data, while mutation jobs store intent and before-state evidence for recovery.

Useful commands:

php queue.php health
php queue.php attention
php queue.php inspect JOB_ID
php queue.php issues JOB_ID
php queue.php reconcile JOB_ID
php queue.php cancel JOB_ID

The Telegram /jobs command lists recent jobs for the current chat. Runtime state, caches, server records, templates, queue jobs, and recovery data remain in MySQL.

Configuration

Queue and scan behavior can be adjusted in config.php:

'queue_budget_seconds' => 55,
'queue_cron_budget_seconds' => 300,
'scan_page_size' => 1000,
'scan_request_timeout_seconds' => 25,
'scan_parallel_requests' => 4,
'queue_retention_days' => 7,
'inline_lease_seconds' => 120,

Keep config.php outside version control because it contains Telegram and database credentials.

Releases

Releases are created from version tags. Update MOPERA_VERSION in version.php, commit the change, then push the matching tag:

git tag -a v1.1.0 -m "Mopera v1.1.0"
git push origin main v1.1.0

GitHub Actions verifies the version, creates a clean ZIP archive and checksum, and publishes them in the corresponding GitHub Release.

About

[m]y [opera]tions - run different operations on your servers using `mopera`

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages