diff --git a/pagermaid/__init__.py b/pagermaid/__init__.py index 3e5434b..c7c11c8 100644 --- a/pagermaid/__init__.py +++ b/pagermaid/__init__.py @@ -13,7 +13,7 @@ from pagermaid.scheduler import scheduler import pyromod.listen from pyrogram import Client -pgm_version = "1.2.6" +pgm_version = "1.2.7" CMD_LIST = {} module_dir = __path__[0] working_dir = getcwd() diff --git a/pyromod/listen/listen.py b/pyromod/listen/listen.py index 651ff57..a1db286 100644 --- a/pyromod/listen/listen.py +++ b/pyromod/listen/listen.py @@ -18,13 +18,13 @@ You should have received a copy of the GNU General Public License along with pyromod. If not, see . """ - import asyncio import contextlib import functools from typing import Optional, List, Union import pyrogram +from pyrogram.enums import ChatType from pagermaid.single_utils import get_sudo_list, Message from pagermaid.scheduler import add_delete_message_job @@ -247,8 +247,13 @@ class Message(pyrogram.types.Message): msg = None sudo_users = get_sudo_list() reply_to = self.reply_to_message - from_id = self.from_user.id if self.from_user else self.sender_chat.id - is_self = self.from_user.is_self if self.from_user else False + from_id = self.chat.id + is_self = False + if self.from_user or self.sender_chat: + from_id = self.from_user.id if self.from_user else self.sender_chat.id + elif self.chat.type == ChatType.PRIVATE: + is_self = True + is_self = self.from_user.is_self if self.from_user else is_self if len(text) < 4096: if from_id in sudo_users or self.chat.id in sudo_users: @@ -256,7 +261,8 @@ class Message(pyrogram.types.Message): msg = await reply_to.reply( text=text, parse_mode=parse_mode, - disable_web_page_preview=disable_web_page_preview + disable_web_page_preview=disable_web_page_preview, + quote=True ) elif is_self: msg = await self._client.edit_message_text( @@ -272,7 +278,8 @@ class Message(pyrogram.types.Message): msg = await self.reply( text=text, parse_mode=parse_mode, - disable_web_page_preview=disable_web_page_preview + disable_web_page_preview=disable_web_page_preview, + quote=True ) else: try: @@ -292,7 +299,8 @@ class Message(pyrogram.types.Message): parse_mode=parse_mode, entities=entities, disable_web_page_preview=disable_web_page_preview, - reply_markup=reply_markup + reply_markup=reply_markup, + quote=True ) else: with open("output.log", "w+") as file: diff --git a/requirements.txt b/requirements.txt index 0878765..81b85fd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pyrogram==2.0.40 +pyrogram==2.0.41 TgCrypto>=1.2.3 Pillow>=8.4.0 pytz>=2021.3