用于telethon会话存储的redis后端
teleredis的Python项目详细描述
由redis支持的Telethon会话存储实现。
用法
此会话实现可以在同一密钥配置单元中存储多个会话。
安装
pip3 install teleredis
升级
pip3 install -U teleredis
快速启动
fromtelethonimportTelegramClientfromteleredisimportRedisSessionimportredis# These example values won't work. You must get your own api_id and# api_hash from https://my.telegram.org, under API Development.api_id=12345api_hash='0123456789abcdef0123456789abcdef'redis_connector=redis.Redis(host='localhost',port=6379,db=0,decode_responses=False)session=RedisSession('session_name',redis_connector)client=TelegramClient(session,api_id,api_hash)client.start()