Compare commits
	
		
			2 Commits
		
	
	
		
			a54d78ccb6
			...
			848caf5342
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 848caf5342 | |||
| 04093d0a20 | 
| @@ -1,3 +1,4 @@ | |||||||
|  | from traceback import print_exc | ||||||
| from app import app, isAnAdmin | from app import app, isAnAdmin | ||||||
| from typing import Any, List, Union | from typing import Any, List, Union | ||||||
| from pyrogram.types import User, ChatMember, ChatPrivileges, Chat, Message, Photo, Video, Document, Animation, Voice | from pyrogram.types import User, ChatMember, ChatPrivileges, Chat, Message, Photo, Video, Document, Animation, Voice | ||||||
| @@ -72,8 +73,8 @@ class HoloUser(): | |||||||
|         logWrite(f"Set attribute {key} of user {self.id} to {value}") |         logWrite(f"Set attribute {key} of user {self.id} to {value}") | ||||||
|  |  | ||||||
|     async def message(self, |     async def message(self, | ||||||
|  |         context: Message, | ||||||
|         origin: Union[Message, None] = None, |         origin: Union[Message, None] = None, | ||||||
|         context: Union[Message, None] = None, |  | ||||||
|         text: Union[str, None] = None, |         text: Union[str, None] = None, | ||||||
|         caption: Union[str, None] = None, |         caption: Union[str, None] = None, | ||||||
|         photo: Union[str, Photo, None] = None, |         photo: Union[str, Photo, None] = None, | ||||||
| @@ -108,6 +109,8 @@ class HoloUser(): | |||||||
|         else: |         else: | ||||||
|             caption = locale("message_reply_notice", "message") |             caption = locale("message_reply_notice", "message") | ||||||
|  |  | ||||||
|  |         try: | ||||||
|  |  | ||||||
|             if origin is not None: |             if origin is not None: | ||||||
|  |  | ||||||
|                 if photo is not None: |                 if photo is not None: | ||||||
| @@ -158,11 +161,13 @@ class HoloUser(): | |||||||
|                 else: |                 else: | ||||||
|                     new_message = await app.send_message(self.id, text) |                     new_message = await app.send_message(self.id, text) | ||||||
|  |  | ||||||
|         # new_message = await app.send_message(self.id, text+locale("message_reply_notice", "message")) |  | ||||||
|             await context.reply_text(locale("message_sent", "message"), quote=should_quote(context)) |             await context.reply_text(locale("message_sent", "message"), quote=should_quote(context)) | ||||||
|  |  | ||||||
|             col_messages.insert_one({"origin": {"chat": context.chat.id, "id": context.id}, "destination": {"chat": new_message.chat.id, "id": new_message.id}}) |             col_messages.insert_one({"origin": {"chat": context.chat.id, "id": context.id}, "destination": {"chat": new_message.chat.id, "id": new_message.id}}) | ||||||
|  |  | ||||||
|  |         except Exception as exp: | ||||||
|  |             await context.reply_text(locale("message_traceback", "message").format(context.from_user.id, self.id, exp, print_exc())) | ||||||
|  |             await context.reply_text(locale("message_error", "message"), quote=should_quote(context)) | ||||||
|  |  | ||||||
|     async def set_label(self, chat: Chat, label: str): |     async def set_label(self, chat: Chat, label: str): | ||||||
|         """Set label in destination group |         """Set label in destination group | ||||||
|  |  | ||||||
|   | |||||||
| @@ -60,6 +60,8 @@ | |||||||
|         "message_invalid_syntax": "Неправильний синтаксис!\nТреба: `/message ID ПОВІДОМЛЕННЯ`", |         "message_invalid_syntax": "Неправильний синтаксис!\nТреба: `/message ID ПОВІДОМЛЕННЯ`", | ||||||
|         "message_from": "Повідомлення від **{0}** (`{1}`):\n\n", |         "message_from": "Повідомлення від **{0}** (`{1}`):\n\n", | ||||||
|         "message_reply_notice": "\n\n**Щоб надіслати відповідь на це повідомлення, тегніть його.**", |         "message_reply_notice": "\n\n**Щоб надіслати відповідь на це повідомлення, тегніть його.**", | ||||||
|  |         "message_error": "⚠️ **Сталась помилка**\nНе вдалось надіслати ваше повідомлення. Розробника повідомлено про цю помилку.", | ||||||
|  |         "message_traceback": "⚠️ **Сталась помилка**\nПомилка повідомлень: `{0}` -> `{1}`\nПомилка: `{2}`\n\nTraceback:\n```\n{3}\n```", | ||||||
|         "question_titles": { |         "question_titles": { | ||||||
|             "question1": "Ім'я/звертання:", |             "question1": "Ім'я/звертання:", | ||||||
|             "question2": "День народження:", |             "question2": "День народження:", | ||||||
|   | |||||||
| @@ -26,14 +26,6 @@ async def cmd_message(app, msg): | |||||||
|             else: |             else: | ||||||
|                 await destination.message(context=msg, text=None, caption=None, photo=msg.photo, video=msg.video, file=msg.document, adm_context=True) |                 await destination.message(context=msg, text=None, caption=None, photo=msg.photo, video=msg.video, file=msg.document, adm_context=True) | ||||||
|          |          | ||||||
|             # try: |  | ||||||
|             #     new_message = await app.send_message(destination.id, message+locale("message_reply_notice", "message")) |  | ||||||
|             #     await msg.reply_text(locale("message_sent", "message"), quote=should_quote(msg)) |  | ||||||
|             #     logWrite(f"Admin {msg.from_user.id} sent message '{' '.join(msg.command[2:])}' to {destination.id}") |  | ||||||
|             #     col_messages.insert_one({"origin": {"chat": msg.chat.id, "id": msg.id}, "destination": {"chat": new_message.chat.id, "id": new_message.id}}) |  | ||||||
|             # except bad_request_400.PeerIdInvalid: |  | ||||||
|             #     await msg.reply_text(locale("message_no_user", "message"), quote=should_quote(msg)) |  | ||||||
|             #     logWrite(f"Admin {msg.from_user.id} tried to send message '{' '.join(msg.command[2:])}' to {destination.id} but 'PeerIdInvalid'") |  | ||||||
|         except IndexError: |         except IndexError: | ||||||
|             await msg.reply_text(locale("message_invalid_syntax", "message"), quote=should_quote(msg)) |             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'") |             logWrite(f"Admin {msg.from_user.id} tried to send message but 'IndexError'") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user