A powerful, fast and simple Telegram userbot written in Python 3 and based on Pyrogram 1.X.
Currently, in active WIP state, so feel free to contribute.
Ensure you have installed the Python 3.8 or above before proceeding.
-
Git clone this repo.
git clone https://github.com/WhiteMemory99/telecharm-userbot.git
-
Visit https://my.telegram.org/apps to get your own
api_id
andapi_hash
. -
Rename
.env.dist
to.env
and open it. -
Edit
.env
file: fill in yourapi_id
,api_hash
. -
(Optional) Visit SauceNao, log in and copy your API key to
saucenao_key
.
This is a must if you want to use the.sauce
command.
Make sure you have docker.
- Build the image. Choose one of the two options below.
docker build -t telecharm-image .
- After building, start the userbot in interactive mode.
docker run -it -v userbot_data:/userbot/app/files --name telecharm telecharm-image
- Enter your number, auth code from Telegram and 2FA password, if you have one.
- Exit the interactive mode with Ctrl+C or any other combination, depends on your system.
- Run the userbot with docker.
docker start telecharm
Make sure you have poetry.
-
Install requirements.
poetry install
-
Run the userbot with poetry.
poetry run python app
-
Install dependencies.
pip install -r requirements.txt
-
Run the userbot.
python3 -m app
Telecharm will automatically gather, generate and update documentation for all the commands you
have. No matter whether you use 3-rd party plugins or write them yourself.
At first launch,
send .help
to any chat to create your personal guide page.
Thanks for using Telecharm :)
-
By convention, all custom plugins are supposed to go to
app/plugins/custom
. -
Go to that folder and create a file named
example.py
as your first tutorial plugin. -
Insert the code below into the file and read all the comments to understand how it works.
Look at the example code
"""
app/plugins/custom/echo.py
This text would also appear in Telecharm guide as a module description.
"""
from pyrogram import Client, filters
from pyrogram.types import Message
from app.utils.decorators import doc_exclude, doc_args
@Client.on_message(filters.me & filters.command("echo", prefixes="."))
@doc_args("text") # Let the Telecharm guide know about the supported args (OPTIONAL)
@doc_exclude # This command will not appear in Telecharm guide, remove this line to check how the generation works :)
async def echo_handler(client: Client, message: Message):
"""
This text would appear in Telecharm guide along with the command if it wasn't excluded.
You can even wrap it like that, or style with supported HTML texts like <b><i>THIS</b></i>.
"""
await message.edit_text(message.text, entities=message.entities)
For more advanced usage, inspect my code and look at app/utils
.
- That's basically all you need to do. You can restart Telecharm and use your new plugin. To
update the guide, just send
.help
to any chat.