Skip to content

Pluggable Telegram bot and userbot based on Telethon

License

Notifications You must be signed in to change notification settings

aritramandal/UniBorg

 
 

Repository files navigation

uniborg

Pluggable asyncio Telegram userbot based on Telethon.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Mozilla Public License for more details.

installing

The Easiest Way

  • Install Docker by following the official docker docs

  • Start docker daemon [skip if already running]:

dockerd
  • Build Docker image:
docker build . -t uniborg
  • Run the image:
docker run uniborg

It is not recommended to use "sudo", while using Docker. GNU/Linux Permissions are highly customisable, and it is generally not required to have "ROOT" permission, unless you know what you are doing. You can still install all the dependencies in your system [with ROOT permissions], but please be aware of the potential issues when doing so. The installed packages may conflict with the system package manager's installed packages, which can cause trouble down the road and errors when upgrading conflicting packages. You have been warned.

The Legacy Way

Simply clone the repository and run the main file:

git clone https://github.com/udf/uniborg.git
cd uniborg
python3 -m venv venv
. ./venv/bin/activate
pip install -r requirements.txt
# <Create config.py with variables as given below>
python3 -m stdborg YourSessionName

An example config.py file could be:

Not All of the variables are mandatory

The UniBorg should work by setting only these variables

from sample_config import Config

class Development(Config):
  APP_ID = 6
  API_HASH = "eb06d4abfb49dc3eeb1aeb98ae0f581e"
  TG_BOT_TOKEN_BF_HER = ""
  TG_BOT_USER_NAME_BF_HER = ""
  UB_BLACK_LIST_CHAT = [
    -1001220993104,
    -1001365798550,
    -1001158304289,
    -1001212593743,
    -1001195845680,
    -1001330468518,
    -1001221185967,
    -1001340243678,
    -1001311056733,
    -1001135438308,
    -1001038774929,
    -1001070622614,
    -1001119331451,
    -1001095401841
  ]
  # specify LOAD and NO_LOAD
  LOAD = []
  NO_LOAD = []

internals

The core features offered by the custom TelegramClient live under the uniborg/ directory, with some utilities, enhancements, the _core plugin, and the _inline_bot plugin.

  • Only two of the environment variables are mandatory.
  • This is because of telethon.errors.rpc_error_list.ApiIdPublishedFloodError
  • The userbot will work without setting the non-mandatory environment variables.
  • Please report any issues to the support group: @SpEcHlDe

design

The modular design of the project enhances your Telegram experience through plugins which you can enable or disable on demand.

Each plugin gets the borg, logger, Config, tgbot magical variables to ease their use. Thus creating a plugin as easy as adding a new file under the plugin directory to do the job:

# stdplugins/myplugin.py
@borg.on(slitu.admin_cmd(pattern="hi"))
async def handler(event):
    await event.reply("hey")

disclaimer

⚠️ This fork uses "requests" module in various places, instead of the async alternative. ⚠️

learning

Check out the already-mentioned plugins directory, or some third-party plugins to learn how to write your own, and consider reading Telethon's documentation.

credits

Thanks to:

About

Pluggable Telegram bot and userbot based on Telethon

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.2%
  • Dockerfile 0.8%