2022-12-05 19:49:51 +02:00
|
|
|
from app import app, isAnAdmin
|
|
|
|
from pyrogram import filters
|
2022-12-12 00:32:20 +02:00
|
|
|
from classes.holo_user import HoloUser
|
2022-12-14 15:19:20 +02:00
|
|
|
from modules.utils import logWrite, locale, configGet, should_quote
|
2022-12-05 19:49:51 +02:00
|
|
|
|
|
|
|
# Message command ==============================================================================================================
|
|
|
|
@app.on_message(~ filters.scheduled & filters.command(["message"], prefixes=["/"]))
|
|
|
|
async def cmd_message(app, msg):
|
|
|
|
|
2022-12-15 15:31:42 +02:00
|
|
|
if await isAnAdmin(msg.from_user.id) is True:
|
2022-12-05 19:49:51 +02:00
|
|
|
|
|
|
|
try:
|
2022-12-12 00:32:20 +02:00
|
|
|
|
2022-12-06 12:10:44 +02:00
|
|
|
try:
|
2022-12-12 00:32:20 +02:00
|
|
|
destination = HoloUser(int(msg.command[1]))
|
2022-12-06 12:10:44 +02:00
|
|
|
except ValueError:
|
2022-12-12 00:32:20 +02:00
|
|
|
destination = HoloUser(msg.command[1])
|
|
|
|
|
2022-12-13 15:24:31 +02:00
|
|
|
if ((msg.text is not None) and (len(msg.text.split()) > 2)):
|
|
|
|
await destination.message(context=msg, text=" ".join(msg.text.split()[2:]), caption=msg.caption, photo=msg.photo, video=msg.video, file=msg.document, adm_context=True)
|
|
|
|
elif ((msg.caption is not None) and (len(msg.caption.split()) > 2)):
|
|
|
|
await destination.message(context=msg, text=msg.text, caption=" ".join(msg.caption.split()[2:]), photo=msg.photo, video=msg.video, file=msg.document, adm_context=True)
|
|
|
|
else:
|
|
|
|
await destination.message(context=msg, text=None, caption=None, photo=msg.photo, video=msg.video, file=msg.document, adm_context=True)
|
2022-12-13 15:33:28 +02:00
|
|
|
|
2022-12-05 19:49:51 +02:00
|
|
|
except IndexError:
|
|
|
|
await msg.reply_text(locale("message_invalid_syntax", "message"), quote=should_quote(msg))
|
|
|
|
logWrite(f"Admin {msg.from_user.id} tried to send message but 'IndexError'")
|
|
|
|
except ValueError:
|
|
|
|
await msg.reply_text(locale("message_invalid_syntax", "message"), quote=should_quote(msg))
|
|
|
|
logWrite(f"Admin {msg.from_user.id} tried to send message but 'ValueError'")
|
|
|
|
# ==============================================================================================================================
|