mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-25 11:28:05 +00:00
Update echo_bot.py
This commit is contained in:
parent
3fa738db9f
commit
bd121be76d
@ -20,9 +20,8 @@ from pyrogram import Client, Filters
|
|||||||
|
|
||||||
"""This simple echo bot replies to every private text message.
|
"""This simple echo bot replies to every private text message.
|
||||||
|
|
||||||
It uses the @on_message decorator to register a MessageHandler
|
It uses the @on_message decorator to register a MessageHandler and applies two filters on it:
|
||||||
and applies two filters on it, Filters.text and Filters.private to make
|
Filters.text and Filters.private to make sure it will reply to private text messages only.
|
||||||
sure it will only reply to private text messages.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
app = Client("my_account")
|
app = Client("my_account")
|
||||||
@ -30,10 +29,7 @@ app = Client("my_account")
|
|||||||
|
|
||||||
@app.on_message(Filters.text & Filters.private)
|
@app.on_message(Filters.text & Filters.private)
|
||||||
def echo(client, message):
|
def echo(client, message):
|
||||||
client.send_message(
|
message.reply(message.text, quote=True)
|
||||||
message.chat.id, message.text,
|
|
||||||
reply_to_message_id=message.message_id
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
app.run() # Automatically start() and idle()
|
app.run() # Automatically start() and idle()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user