Skip to content

Recovery System

prototype74 edited this page Sep 8, 2021 · 12 revisions

The Recovery System is a special service by HyperUBot. It should help the user to be able to recover the userbot from backups or generating new backups to be on the safe side. It's also responsible to apply new updates for HyperUBot. This page will explain the usage and the options the Recovery System does offer.

Do not delete the Recovery System. This will break the update mechanism of HyperUBot!

Start the Recovery System

To start into the Recovery System, locate to HyperUBot's directory and execute the following command:

  • POSIX systems: python3 recovery.py (or python3.8 recovery.py on some distros)
  • Windows: python recovery.py

Options

There are some options such as start options to HyperUBot, applying updates manually or reinstall the whole userbot.

1. Start HyperUBot

This option will start HyperUBot normally without any special argument.

Note: not suppported by Windows

2. Start HyperUBot (safe mode)

This option will start HyperUBot into safemode. Safmode is a special start which disables all user modules. Useful to remove broken modules without getting spammed with errors.

Note: not suppported by Windows

3. Clear caches

Clears the generated cpython caches in HyperUBot. Useful to remove leftovers from deleted modules.

4. Apply update

The Recovery System also offers an option to apply bot updates manually. To do so, you need to get update.zip, it's rules.py and create the required directory manually before you start the recovery.

Get the update manually on POSIX systems

Locate to HyperUBot's directory and execute the following commands in your terminal:

  1. mkdir releases
  2. curl -H "Accept: application/json" https://api.github.com/repos/prototype74/HyperUBot/releases/latest | grep '"zipball_url"' | cut -d '"' -f4 | wget --output-document=releases/update.zip -i -
  3. curl -H "Accept: application/json" https://api.github.com/repos/prototype74/HyperUBot/releases/latest | grep '"browser_download_url"' | cut -d '"' -f4 | wget --output-document=releases/rules.py -i -

Check in releases directory if update.zip and rules.py exists or if the file sizes are not zero. Simply check it by executing ls -l releases in your terminal.

Get the update manually on Windows

  1. Locate to HyperUBot's directory and create a folder named releases
  2. Open the link https://api.github.com/repos/prototype74/HyperUBot/releases/latest in your browser (make sure your browser supports JSON)
  3. Search for zipball_url it should be at the bottom of the site. Click on the link, it will download the ZIP file
  4. Search for browser_download_url it should be at the bottom of the site but before zipball_url. Click on the link, it will download the rules.py file
  5. Rename the downloaded ZIP file to update.zip move the update.zip and rules.py to the releases folder in HyperUBot's directory

The stucture should be now like this:
HyperUBot\releases\rules.py
HyperUBot\releases\update.zip

If so check in releases directory if update.zip and rules.py exists or if the file sizes are not zero.

Get the commit ID

Go to the Releases section of HyperUBot's repository. To the left side bar (mobile version: on top) there is the commit ID below (mobile version: it's next to) the tag version e.g. 6f9bda6 (v5.0.2 release). Copy it, you will need this ID to apply the recently downloaded update.

Apply the update manually

  1. Start the Recovery System now
  2. Select Apply update option
  3. Input the commit ID
  4. Wait for the Recovery to finish the update

That's it! It's definitely more complex than the automatic way, the Updater module usually do. So apply update manually only if it's actually necessary.

5. Backup current version

This will backup the current installed version. Generated backups are stored a backup folder in HyperUBot's directory. If a backup with the same version does exist already, the Recovery System will overwrite the old backup archive.

6. Restore

Lists generated backups and restores the selected backup archive.

Warning: performing a restore CANNOT be undone!

7. Reinstall HyperUBot

This option will delete all downloaded user modules, the configurations including the string session and any other data in HyperUBot's directory. At last, the latest release will be installed automatically and you have to setup everything again

Warning: this process CANNOT be undone!

Displayed information

It may be possible that the Recovery System does display information on top of the Main menu (colored).

"Directory is a local git repository"

Some options will be colored to yellow, it's just a warning that these options can break the git history of your git repository. If you take changes in the source then you shouldn't ignore this warning.

"Directory might be git initialized"

Similar to Directory is a local git repository the only difference is the Recovery System wasn't able to detect the actually git history but detected an initialized .git folder.

"HyperUBot version: X.X.X or Unknown"

Displays the current installed version. If it's Unknown it could be possible that HyperUBot isn't installed at all, installed but broken or an older version is installed.

"HyperUBot is not installed"

This means as it is mentioned above, the userbot isn't installed and many options will be disabled. This could happen after a failed update or due to other reasons that made the userbot directory unusable. The possible options are to restore a backup or in worst case reinstalling the userbot.