A shell for telethon
Project description
teleshell
Install:
pip install teleshell
Sample usage:
from teleshell import *
from telethon import TelegramClient
client = TelegramClient('bot', api_id, 'api_hash').start(bot_token='token')
async def add_user(event):
for user in users:
if user == event.chat_id:
return None
users.append(event.chat_id)
shell = ClientShell(client=client, default_first=add_user)
handle = shell.handle
users = []
@handle(text='hi', lower=True, first=False)
async def func(event):
await event.reply('Hello!')
@handle(text=r'he(l){1,7}o', lower=True, regular=True)
async def func(event):
await event.reply('Hellllllllo!')
@handle(command='start')
async def func(event):
await event.reply('Start!')
@handle(command='help', first=add_user)
async def func(event):
await event.reply('Help!')
client.run_until_disconnected()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
teleshell-0.0.1.tar.gz
(1.9 kB
view hashes)
Built Distribution
teleshell-0.0.1-py3-none-any.whl
(13.4 kB
view hashes)
Close
Hashes for teleshell-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e5965cf6e9954607068cb0d5feaff11ecb8895fbaf2774a60322c93debcbb8b |
|
MD5 | 1234a89d77a015acc2195c4ff3501862 |
|
BLAKE2b-256 | e16c5bdca6c9bc50d8d53a5275e17cc9e1e7566257e3ce42d5553a361dd94511 |