diff --git a/pagermaid/__init__.py b/pagermaid/__init__.py index 47add77..3e5434b 100644 --- a/pagermaid/__init__.py +++ b/pagermaid/__init__.py @@ -1,4 +1,5 @@ import contextlib +import sys from typing import Callable, Awaitable, Set, Dict @@ -7,15 +8,12 @@ from datetime import datetime, timezone from logging import getLogger, StreamHandler, CRITICAL, INFO, basicConfig, DEBUG, Formatter, FileHandler from os import getcwd -from pyrogram.errors import PeerIdInvalid - from pagermaid.config import Config from pagermaid.scheduler import scheduler import pyromod.listen from pyrogram import Client -import sys -pgm_version = "1.2.5" +pgm_version = "1.2.6" CMD_LIST = {} module_dir = __path__[0] working_dir = getcwd() @@ -78,5 +76,6 @@ async def log(message): Config.LOG_ID, message ) - except PeerIdInvalid: + except Exception: Config.LOG = False + Config.LOG_ID = "me" diff --git a/pagermaid/modules/backup.py b/pagermaid/modules/backup.py index f55a1e2..5bf2ea2 100644 --- a/pagermaid/modules/backup.py +++ b/pagermaid/modules/backup.py @@ -95,4 +95,4 @@ async def recovery(message: Message): os.remove(pgm_backup_zip_name) await message.edit(lang('recovery_success') + " " + lang('apt_reboot')) - sys.exit(1) + sys.exit(0) diff --git a/pagermaid/utils.py b/pagermaid/utils.py index 8b39f97..65f78f0 100644 --- a/pagermaid/utils.py +++ b/pagermaid/utils.py @@ -163,17 +163,13 @@ def sudo_filter(permission: str): def from_self(message: Message) -> bool: if message.outgoing: return True - if message.from_user: - return message.from_user.is_self - return False + return message.from_user.is_self if message.from_user else False def from_msg_get_sudo_uid(message: Message) -> int: """ Get the sudo uid from the message. """ from_id = message.from_user.id if message.from_user else message.sender_chat.id - if from_id in get_sudo_list(): - return from_id - return message.chat.id + return from_id if from_id in get_sudo_list() else message.chat.id def check_manage_subs(message: Message) -> bool: diff --git a/requirements.txt b/requirements.txt index 2b8d3a7..e88112c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pyrogram==2.0.35 +pyrogram==2.0.38 TgCrypto>=1.2.3 Pillow>=8.4.0 pytz>=2021.3 @@ -8,7 +8,7 @@ psutil>=5.8.0 httpx apscheduler sqlitedict -casbin==1.16.11 -mixpanel +casbin==1.17.0 +mixpanel==4.10.0 mixpanel-py-async -sentry-sdk==1.9.0 +sentry-sdk==1.9.4