2018-05-06 11:56:25 +02:00
|
|
|
"""This simple echo bot replies to every private text message.
|
|
|
|
|
2018-10-09 13:50:34 +02:00
|
|
|
It uses the @on_message decorator to register a MessageHandler and applies two filters on it:
|
|
|
|
Filters.text and Filters.private to make sure it will reply to private text messages only.
|
2018-05-06 11:56:25 +02:00
|
|
|
"""
|
2018-04-14 18:46:54 +02:00
|
|
|
|
2018-10-09 15:23:40 +02:00
|
|
|
from pyrogram import Client, Filters
|
|
|
|
|
2018-04-14 18:46:54 +02:00
|
|
|
app = Client("my_account")
|
|
|
|
|
|
|
|
|
|
|
|
@app.on_message(Filters.text & Filters.private)
|
|
|
|
def echo(client, message):
|
2019-01-07 10:33:09 +01:00
|
|
|
message.reply(message.text)
|
2018-04-14 18:46:54 +02:00
|
|
|
|
|
|
|
|
2018-06-22 13:30:18 +02:00
|
|
|
app.run() # Automatically start() and idle()
|