https://github.com/moodyhunter/userbot
My Telegram Userbot framework
https://github.com/moodyhunter/userbot
Last synced: 2 months ago
JSON representation
My Telegram Userbot framework
- Host: GitHub
- URL: https://github.com/moodyhunter/userbot
- Owner: moodyhunter
- License: gpl-3.0
- Created: 2022-07-10T15:09:58.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-21T22:14:28.000Z (over 1 year ago)
- Last Synced: 2025-03-28T18:53:18.596Z (3 months ago)
- Language: Python
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# My Telegram Userbot Framework
It's actually a wrapper around [Pyrogram](https://pyrogram.readthedocs.io/en/latest/).
## Usage
1. Define your `local_config.py` file (copy paste from `local_config.sample.py` and edit accordingly).
2. In the main file of your userbot, add the following line:
```python
from userbot import StartBot, LoadPluginspathglob = "plugins/*.py"
LoadPlugins(pathglob)
StartBot()
```3. For a simple plugin, you can just add the following line:
```python
from asyncio import sleep
from random import random
import pyrogram
from userbot import TgUserBot, register@register("?", pattern="^[??¿]+$", incoming=True)
async def _(bot: TgUserBot, message: pyrogram.types.Message):
if random() < 0.7:
await sleep(random() * 4)
await message.reply_text("?", quote=True)```
## License
GPLv3