-
Notifications
You must be signed in to change notification settings - Fork 11
Configurations
HyperUBot supports configurations which allow the user to set different settings when needed. The App api_id (API Key)
, App api_hash (API Hash)
and the String session
are the most essential configurations in order to run the userbot properly. All other pre-defined configurations are optional and not required to run the userbot. The optional configurations bring up different useful features e.g. allow the user to set a different language, logging events or change the download path of downloaded files. HyperUBot's configurations system has no limitation, in other words, the user can add tons of configs without waiting for the Maintainers to add support for them.
The essential configurations are stored in a protected file while the optional configurations are stored in a separate file
Since v5.0.0, the App api_id (API Key)
, App api_hash (API Hash)
and the String session
are stored in an AES256 encrypted secure config
file to protect these sensitive data from unauthorized access. HyperUBot reads the secure config only at initialization part and straight removes the access to these data after the Telegram client has started. This prevents modules to import these values without the knowing of the user.
The Secure-Config-Updater creates an AES256 encrypted file with your App api_id (API Key)
, App api_hash (API Hash)
and String session
stored. If a secure config is required, locate to HyperUBot's directory in your terminal and run the following command:
-
Docker: Run docker image/container then select
Secure-Config-Updater
-
POSIX systems:
python3 update_secure_cfg.py
(if it fails, try it by python version e.g.python3.8 update_secure_cfg.py
) -
Windows:
python update_secure_cfg.py
Tip: Secure-Config-Updater also offers an option to set a password (optional but recommended)
Note: if you forgot your password, you have to create a new secure config file!
Configuration files are optional since version 5.0.0. HyperUBot version 4.1.0 and below require a configuration file.
Example config file:
class ConfigClass(object):
UBOT_LANG = "en"
LOGGING = False
LOGGING_CHATID = 0
TEMP_DL_DIR = "./downloads"
NOT_LOAD_MODULES = []
COMMUNITY_REPOS = []
There are 3 types of config files supported by HyperUBot:
- Environment (config.env)
- Configurations (config.ini, since v6.0.0)
- Python Script (config.py; recommended)
Notes: since v6.0.0, HyperUBot will prompt you to select a config file if multiple config files are configured in
userbot
directory.
- Locate to HyperUBot's directory
- Open the
userbot
folder - Find your config file (config.env, config.ini or config.py)
- Open it in an editor (Nano editor is recommended when editing in Terminal)
- Add your configs under the last config
Example with config.py:
class ConfigClass(object):
UBOT_LANG = "en"
LOGGING = True
LOGGING_CHATID = -100123456789
TEMP_DL_DIR = "./downloads"
NOT_LOAD_MODULES = []
COMMUNITY_REPOS = ["myAccount/myRepo"]
ALLOW_SIDELOAD = False
PKG_ENABLE_AUTO_UPDATE = True
MY_CUSTOM_CONFIG_1 = "custom stuff" # your custom config
MY_CUSTOM_CONFIG_2 = 123456789 # your custom config
This section explains all pre-defined configurations used by HyperUBot
ALLOW_SIDELOAD - datatype: boolean
(since v5.0.0):
Allow the bot to sideload modules from Telegram chats. By enabling this config you accept the risk of sideloading modules.
Example: ALLOW_SIDELOAD = True
(config.ini: ALLOW_SIDELOAD = yes
)
API_HASH - datatype: string
(deprecated since v5.0.0):
Your App api_hash from My Telegram.
Hash should have a length of 32!.
Example: API_HASH = "123456789abcdefghijklmnopqrstuvw"
Note: required for HyperUBot v4.1.0 and below
API_KEY - datatype: string
or integer
(deprecated since v5.0.0):
Your App api_id from My Telegram
Example: API_KEY = 123456
Note: required for HyperUBot v4.1.0 and below
CLIENT_CONNECT_RETRIES - datatype: int
(since v6.3.1):
How many times the client should try to reconnect to the Telegram servers.
Value -1 means infinity tries.
Example: CLIENT_CONNECT_RETRIES = 7
CLIENT_RETRY_DELAY - datatype: float
or integer
(since v6.3.1):
Delay in seconds between automatic reconnect.
Example: CLIENT_RETRY_DELAY = 10
COMMUNITY_REPOS - datatype: list
:
Community extra repos, includes a list of string with owner/repo-combos.
The format of the repo should be "github_username/github_repo"
.
Example: COMMUNITY_REPOS = ["nunopenim/modules-universe"]
LOGGING - datatype: boolean
:
Enable or disable bot logging events. Events are for example ban, reboot, leaving chats.
Example: LOGGING = True
(config.ini: LOGGING = yes
)
LOGGING_CHATID - datatype: integer
:
The chat ID where bot logging events should be send. Requires LOGGING to be enabled.
Example: LOGGING_CHATID = -100123456789
NOT_LOAD_MODULES - datatype: list
:
Skips to load specific module(s).
Example: NOT_LOAD_MODULES = ["admin"]
PKG_ENABLE_AUTO_UPDATE - datatype: boolean
(since v6.0.0):
Automactially update the list of repository data when listing packages if the last update was about an hour ago.
Example: PKG_ENABLE_AUTO_UPDATE = True
(config.ini: PKG_ENABLE_AUTO_UPDATE = yes
)
PKG_DISABLE_AUTO_REBOOT - datatype: boolean
(since v6.0.0; deprecated since v7.0.0):
Don't reboot automatically if new user modules are installed or uninstalled.
Example: PKG_DISABLE_AUTO_REBOOT = True
(config.ini: PKG_DISABLE_AUTO_REBOOT = yes
)
SIDELOAD_NO_REBOOT - datatype: boolean
(since v7.0.0):
Start the sideloaded module right after it's installed which does not prompt a reboot.
Example: SIDELOAD_NO_REBOOT = True
(config.ini: SIDELOAD_NO_REBOOT = yes
)
STRING_SESSION - datatype: string
(deprecated since v5.0.0):
The string session allows the userbot to login into your Telegram account.
IMPORTANT: DO NOT SHARE THIS VALUE WITH ANYONE ELSE!
Example: STRING_SESSION = "1uphrg_fiewjfp9mcfewiopcmuipqiufie9um09c0m4u3t04vmu943tuvavtw0tvtOUN9Hipbljubwni987biwfq="
Note: required for HyperUBot v4.1.0 and below
TEMP_DL_DIR - datatype: string
:
The download path where to store downloaded file(s) (temporary).
Example: TEMP_DL_DIR = "./downloads"
(config.ini: TEMP_DL_DIR = ./downloads
)
Note: Windows uses backslashes for paths instead of slashes
TERMINAL_USE_BIN_BASH - datatype: boolean
(since v7.0.0):
POSIX only: use Bash (/bin/bash) as shell executor instead of sh (/bin/sh)
in terminal module.
Example: TERMINAL_USE_BIN_BASH = True
(config.ini: TERMINAL_USE_BIN_BASH = yes
)
Note: This config has no effect on Windows (PowerShell)
UBOT_LANG - datatype: string
:
Userbot display language.
Supported languages:
- English (EN)
- German (DE)
- Portuguese (PT)
Example: UBOT_LANG = "en"
(config.ini: UBOT_LANG = en
)
UPDATER_ENABLE_SCHEDULER - datatype: boolean
(since v7.1.0):
Check for bot updates once each day. If there is a new update available
the update scheduler will notify the user about it by sending a message to
it's saved messages.
Example: UPDATER_ENABLE_SCHEDULER = True
(config.ini: UPDATER_ENABLE_SCHEDULER = yes
)
USERDATA - datatype: string
(unmodifyable; since v5.0.1):
Links to the userdata directory path where modules are able to store data there permanently.
HyperUBot - A customizable, modular Telegram userbot, with innovative components.
Copyright © 2020-2023 nunopenim & prototype74, licensed under PEL