mirror of
https://github.com/avipatilpro/FileStreamBot.git
synced 2026-01-16 14:52:52 -03:00
22 lines
695 B
Python
22 lines
695 B
Python
# (c) @AbirHasan2005
|
|
|
|
import asyncio
|
|
import traceback
|
|
from pyrogram.errors import FloodWait, InputUserDeactivated, UserIsBlocked, PeerIdInvalid
|
|
|
|
|
|
async def send_msg(user_id, message):
|
|
try:
|
|
await message.forward(chat_id=user_id)
|
|
return 200, None
|
|
except FloodWait as e:
|
|
await asyncio.sleep(e.x)
|
|
return send_msg(user_id, message)
|
|
except InputUserDeactivated:
|
|
return 400, f"{user_id} : deactivated\n"
|
|
except UserIsBlocked:
|
|
return 400, f"{user_id} : blocked the bot\n"
|
|
except PeerIdInvalid:
|
|
return 400, f"{user_id} : user id invalid\n"
|
|
except Exception as e:
|
|
return 500, f"{user_id} : {traceback.format_exc()}\n" |