A Telegram Userbot based on Pyrogram
This repository contains the source code of a Telegram Userbot and the instructions for running a copy yourself. Beside its main purpose, the bot is featuring Pyrogram Asyncio and Smart Plugins; feel free to explore the source code to learn more about these topics.
I assume you will read this whole README.md file before continuing.
Development in progress.
You're gonna need to get the following programs and services either installed on your server or signed up for. You must do all. It is a cardinal sin if you don't.
-
virtualenv
installed so that the packages don't interfere with other system packages. -
MongoDB on your server or a free server from MongoDB Atlas. (I recommend Atlas as I used it during development with no issues.)
-
carbon-now-cli on your server too generate code images for the carbon.py module. I use this CLI tool cause I don't know and couldn't get selenium and chromedriver to work nicely on my server/code. I'll be nice and even give you the command to install this. I assume you already have NPM installed.
Windows: npm install -g carbon-now-cli Linux: sudo npm install -g carbon-now-cli --unsafe-perm=true --allow-root MacOS: I assume almost the same as linux ¯\_(ツ)_/¯
One Click Deploy Quick Deploy on Heroku using the button down below:
The way I deploy
git clone https://github.com/athphane/userbot.git
cd userbot
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
python -m userbot.
To add extra modules to the bot, simply add the code into userbot/plugins. Each file that is added to the plugins directory should have the following code at a minimum.
from pyrogram import Message, Filters
from userbot import UserBot
@UserBot.on_message(Filters.command('sample', ['.']))
async def module_name(bot: UserBot, message: Message):
await message.edit(
"This is a sample module"
)
This example is only for Pyrogram on_message events.
-
Dan for his Pyrogram Library
-
Colin Shark for his PyroBot which helped with most of the useful functions used.
-
The people at MyPaperPlane for their Telegram-UserBot that gave a ton of ideas on how and what modules to include in this userbot.
-
Baivaru for the ton of help that got me this far into making this repo.
Made with love from the Maldives ❤