Skip to main content

Multi Sessions addon for Telethon

Project description

Multi Sessions addon for Telethon


pip3 install tlmulticlient

How to use:

# importing multiclient library and other required imports
from tlmulticlient import MultiClient
import asyncio
from telethon import events
# create the multiclient

client = MultiClient(api_id=12345, api_hash='my_api_hash', sessions=['list', 'of', 'str_sessions'])

# listenting to new messages

def listener(event):
    # Now we need to use `event.client.etc` instead of client.etc to be able to run a function on all the available clients!
    await event.client.send_message(event.chat_id, "Hello World!")

    # To find out from which session an event was triggered we use:
    id = event.client.session_id # session id is the name of the session attached to the client which received the event.
    if id == 'str_sessions':
        print('This event was triggered from the session named str_sessions')
        print('This event was triggered from the session named {0}'.format(id))

# iterate though all the clients

for c in client:

# run all the clients

loop = asyncio.get_event_loop()

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tlmulticlient, version 0.0.5
Filename, size File type Python version Upload date Hashes
Filename, size tlmulticlient-0.0.5-py2.py3-none-any.whl (3.6 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page