from pyrogram import Client
from pyrogram import types, filters
from pyrogram.errors.exceptions.bad_request_400 import ReactionInvalid, ReactionEmpty
from random import choice
import time
app = Client(
"my_account",
api_id=,
api_hash=""
)
@app.on_message(filters=filters.incoming)
def call_react(client: Client, message: types.Message):
smile = '❤️'
time.sleep(2)
try:
app.send_reaction(chat_id=message.chat.id, message_id=message.id, emoji=choice(smile))
except (ReactionInvalid, ReactionEmpty):
for i in smile:
time.sleep(2)
try:
app.send_reaction(chat_id=message.chat.id, message_id=message.id, emoji=i)
break
except ReactionInvalid:
continue
app.run()