Bot Panel: updating a bot from GitHub, rollback and scheduled tasks

Every bot has an Automation tab with two blocks: Code from Git, where the bot updates itself from your repository, and Scheduled tasks, commands the panel runs at set times.

Connect the repository

  1. Open the bot → Automation tab.
  2. In Repository address paste a GitHub, GitLab or Bitbucket link such as https://github.com/user/my-bot. In Branch enter the branch to take code from, usually main.
  3. Tick Update automatically after every push if the bot should update itself.
  4. Click Save, then Check access. “Access OK, latest commit …” means everything is ready.
  5. Update now installs the version that is in the branch right now.

Automation tab: code from Git and the access key

Files from the repository replace bot files with the same names and add new ones. Files that are not in the repository (such as the bot's SQLite database) stay in place; Config Vars and the .env file do not change. So keep the token in Config Vars, not in the repository. If you deleted a file in the repository, delete it on the Files tab too.

Private repository

For a private repository the panel creates an access key that can only read this one repository. The panel needs no GitHub password or token.

  1. In the Private repository block click Create access key, then Copy key.
  2. GitHub: open the repository → Settings → Deploy keys → Add deploy key. Paste the key into Key, any title. Leave Allow write access off. Click Add key.
  3. GitLab: repository → Settings → Repository → Deploy keys. Bitbucket: Repository settings → Access keys.
  4. Back in the panel, click Check access.

Each bot has its own key. GitHub does not allow one key in two repositories: for a second bot, create a key on its own Automation tab. No longer need the key? Click Delete key in the panel and remove it in the repository settings. When a bot is deleted, its key is deleted too.

How auto-update works

The panel checks the branch every 2 minutes. No incoming connections or webhooks are needed: the panel contacts the repository itself. When a new commit appears in the branch, the panel:

  1. downloads the new version and keeps a copy of the replaced files (the last three are kept);
  2. installs libraries if requirements.txt, package.json, composer.json or Gemfile changed;
  3. restarts the bot if it was running and watches it for about a minute. A stopped bot only gets the new files.

If the new version does not start, the panel restores the previous one by itself, starts the bot and sends a notification. The block shows “The new version did not start, the previous one is back”. The panel does not install that version again: find the cause on the Logs tab, fix it and push again.

Scheduled tasks

A task is a command the panel runs on a schedule: clean old records, send a report, refresh data. It runs in the bot folder with the bot's Config Vars and the same limits as the bot. The bot itself may be running or stopped.

  1. Click Add task.
  2. Name — anything. Command starts with python, node, php, ruby, bash or sh, e.g. python cleanup.py or node scripts/report.js.
  3. When: Every — from 5 minutes to 24 hours, or Daily at — a set time (server time).
  4. Stop if it runs longer than — from 1 minute to 1 hour: the panel stops a hung task itself.
  5. Keep Notify if the task fails on and click Save.

Scheduled tasks

Each task shows when it last ran, how it ended and when it runs next. Run starts it right away, Log shows the output. Up to 10 tasks per bot. At most two tasks run at the same time on the server; if times coincide, the extra run is skipped until next time.

Notifications

The panel reports a rollback and a failed task to the same place as a bot crash: Telegram and/or a Discord channel. How to turn them on — see panel settings.

Questions and answers
Check the address. If the repository is private, create an access key and add it to Deploy keys of this repository.
The key was added to another repository or copied only in part. Copy it with Copy key and add it to Deploy keys of exactly the repository whose address is in the panel.
Within 2 minutes. Update now installs the new version right away.
Best is to push a fix or revert the commit (git revert). You can also undo the last update with Roll back — see the Files and editor article.
No. If something must happen all the time, do it inside the bot itself.

Choose language