🔖 Update to v1.4.4

Default ignore reacted edit message
This commit is contained in:
xtaodada 2023-12-13 12:53:03 +08:00
parent 8fb39b1e2e
commit a617027a00
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
3 changed files with 24 additions and 5 deletions

View File

@ -22,8 +22,8 @@ from pagermaid.scheduler import scheduler
import pyromod.listen import pyromod.listen
from pyrogram import Client from pyrogram import Client
pgm_version = "1.4.3" pgm_version = "1.4.4"
pgm_version_code = 1403 pgm_version_code = 1404
CMD_LIST = {} CMD_LIST = {}
module_dir = __path__[0] module_dir = __path__[0]
working_dir = getcwd() working_dir = getcwd()
@ -50,7 +50,9 @@ root_logger.addHandler(logging_handler)
pyro_logger = getLogger("pyrogram") pyro_logger = getLogger("pyrogram")
pyro_logger.setLevel(INFO if Config.DEBUG else CRITICAL) pyro_logger.setLevel(INFO if Config.DEBUG else CRITICAL)
pyro_logger.addHandler(logging_handler) pyro_logger.addHandler(logging_handler)
file_handler = FileHandler(filename="data/pagermaid.log.txt", mode="w", encoding="utf-8") file_handler = FileHandler(
filename="data/pagermaid.log.txt", mode="w", encoding="utf-8"
)
file_handler.setFormatter(Formatter(logging_format)) file_handler.setFormatter(Formatter(logging_format))
root_logger.addHandler(file_handler) root_logger.addHandler(file_handler)
basicConfig(level=DEBUG if Config.DEBUG else INFO) basicConfig(level=DEBUG if Config.DEBUG else INFO)

View File

@ -35,6 +35,7 @@ from pagermaid.utils import (
) )
from pagermaid.hook import Hook from pagermaid.hook import Hook
from pagermaid.web import web from pagermaid.web import web
from pyromod.utils import mod_filters
_lock = asyncio.Lock() _lock = asyncio.Lock()
@ -49,6 +50,7 @@ def listener(**args):
pattern = sudo_pattern = args.get("pattern") pattern = sudo_pattern = args.get("pattern")
diagnostics = args.get("diagnostics", True) diagnostics = args.get("diagnostics", True)
ignore_edited = args.get("ignore_edited", False) ignore_edited = args.get("ignore_edited", False)
ignore_reacted = args.get("ignore_reacted", True)
ignore_forwarded = args.get("ignore_forwarded", True) ignore_forwarded = args.get("ignore_forwarded", True)
is_plugin = args.get("is_plugin", True) is_plugin = args.get("is_plugin", True)
incoming = args.get("incoming", False) incoming = args.get("incoming", False)
@ -84,8 +86,6 @@ def listener(**args):
sudo_pattern = f"(?i){sudo_pattern}" sudo_pattern = f"(?i){sudo_pattern}"
if outgoing and not incoming: if outgoing and not incoming:
base_filters = filters.me & ~filters.via_bot base_filters = filters.me & ~filters.via_bot
if ignore_forwarded:
base_filters &= ~filters.forwarded
elif incoming and not outgoing: elif incoming and not outgoing:
base_filters = filters.incoming & ~filters.me base_filters = filters.incoming & ~filters.me
else: else:
@ -93,7 +93,11 @@ def listener(**args):
permission_name = get_permission_name(is_plugin, need_admin, command) permission_name = get_permission_name(is_plugin, need_admin, command)
sudo_filters = sudo_filter(permission_name) & ~filters.via_bot sudo_filters = sudo_filter(permission_name) & ~filters.via_bot
if ignore_forwarded: if ignore_forwarded:
base_filters &= ~filters.forwarded
sudo_filters &= ~filters.forwarded sudo_filters &= ~filters.forwarded
if ignore_reacted:
base_filters &= ~mod_filters.reacted
sudo_filters &= ~mod_filters.reacted
if args["pattern"]: if args["pattern"]:
base_filters &= filters.regex(args["pattern"]) base_filters &= filters.regex(args["pattern"])
sudo_filters &= filters.regex(sudo_pattern) sudo_filters &= filters.regex(sudo_pattern)
@ -105,6 +109,8 @@ def listener(**args):
sudo_filters &= filters.private sudo_filters &= filters.private
if "ignore_edited" in args: if "ignore_edited" in args:
del args["ignore_edited"] del args["ignore_edited"]
if "ignore_reacted" in args:
del args["ignore_reacted"]
if "ignore_forwarded" in args: if "ignore_forwarded" in args:
del args["ignore_forwarded"] del args["ignore_forwarded"]
if "command" in args: if "command" in args:

View File

@ -0,0 +1,11 @@
from pyrogram.filters import create
from pagermaid.enums import Message
async def reacted_filter(_, __, m: Message):
return m.reactions is not None
reacted = create(reacted_filter)
"""Filter messages that are reacted."""