mirror of
https://github.com/TeamPGM/PagerMaid-Pyro.git
synced 2024-11-21 18:18:17 +00:00
🔖 Update to v1.2.5
This commit is contained in:
parent
21f58ba3d4
commit
772b58b2b6
2
.gitignore
vendored
2
.gitignore
vendored
@ -128,6 +128,8 @@ keyword.list
|
||||
requirements2.txt
|
||||
languages/custom.yml
|
||||
unknown_errors.txt
|
||||
pagermaid*.txt
|
||||
exception*.txt
|
||||
output.log
|
||||
|
||||
# Spyder project settings
|
||||
|
@ -494,6 +494,10 @@ eval_parameters: <command>
|
||||
eval_channel: Something went wrong ~ The current PagerMaid-Pyro configuration prohibits the execution of Python commands in the channel.
|
||||
eval_success: execute Python commands remotely
|
||||
eval_need_dev: '**Please note: This command can directly operate your account** This command is only for developers. If you know what you are doing, please manually configure the `dev` item in the Redis database to any value or create the `dev` file in the `data` folder.'
|
||||
## send_log
|
||||
send_log_des: Send the log file to the specified user.
|
||||
send_log_not_found: The log file does not exist.
|
||||
send_log_caption: Log file of PagerMaid-Pyro.
|
||||
## restart
|
||||
restart_des: Restart PagerMaid-Pyro
|
||||
restart_processing: Try to restart PagerMaid-Pyro.
|
||||
|
@ -494,6 +494,10 @@ eval_parameters: <command>
|
||||
eval_channel: Something went wrong ~ The current Maid-Pyro configuration prohibits the execution of Python commands in the channel.
|
||||
eval_success: execute Python commands remotey
|
||||
eval_need_dev: '**Please note: This command can directly operate your account** This command is only for developers. If you know what you are doing, and please manually configure the `dev` item in the Redis database to any value or create the `dev` file in the `data` folder。'
|
||||
## send_log
|
||||
send_log_des: 指定したユーザーにログ ファイルを送信します。
|
||||
send_log_not_found: ログファイルが存在しません。
|
||||
send_log_caption: PagerMaid-Pyroのログファイル。
|
||||
## restart
|
||||
restart_des: Restart PagerMaid-Pyro
|
||||
restart_processing: to restart PagerMaid-Pyro.
|
||||
|
@ -494,6 +494,10 @@ eval_parameters: <命令>
|
||||
eval_channel: 出错了呜呜呜 ~ 当前 PagerMaid-Pyro 的配置禁止在频道中执行 Python 命令。
|
||||
eval_success: 远程执行 Python 命令
|
||||
eval_need_dev: '**请注意:此命令可以直接操作您的账户** 此命令仅适用于开发者,如果您知道您在做什么的话,请手动在 Redis 数据库配置 dev 项为任意值或者在 data 文件夹下创建 dev 文件。'
|
||||
## send_log
|
||||
send_log_des: 将日志文件发送给指定用户
|
||||
send_log_not_found: 日志文件不存在。
|
||||
send_log_caption: PagerMaid-Pyro 日志文件
|
||||
## restart
|
||||
restart_des: 使 PagerMaid-Pyro 重新启动
|
||||
restart_processing: 尝试重启 PagerMaid-Pyro...
|
||||
|
@ -494,6 +494,10 @@ eval_parameters: <指令>
|
||||
eval_channel: Error!不能在頻道執行指令。
|
||||
eval_success: 執行 Python 指令
|
||||
eval_need_dev: '**請注意:此命令可以直接操作您的賬戶** 此命令僅適用於開發者,如果您知道您在做什麼的話,請手動在 Redis 數據庫配置 dev 項為任意值或者在 data 文件夾下創建 dev 文件。'
|
||||
## send_log
|
||||
send_log_des: 將日誌文件發送到指定的用戶
|
||||
send_log_not_found: 日誌文件不存在
|
||||
send_log_caption: PagerMaid-Pyro 日誌文件
|
||||
## restart
|
||||
restart_des: 重新啟動
|
||||
restart_processing: 正在嘗試重新啟動
|
||||
|
@ -1,9 +1,10 @@
|
||||
import contextlib
|
||||
|
||||
from typing import Callable, Awaitable, Set, Dict
|
||||
|
||||
from coloredlogs import ColoredFormatter
|
||||
from datetime import datetime, timezone
|
||||
from logging import getLogger, StreamHandler, CRITICAL, INFO, basicConfig, DEBUG
|
||||
from logging import getLogger, StreamHandler, CRITICAL, INFO, basicConfig, DEBUG, Formatter, FileHandler
|
||||
from os import getcwd
|
||||
|
||||
from pyrogram.errors import PeerIdInvalid
|
||||
@ -14,7 +15,7 @@ import pyromod.listen
|
||||
from pyrogram import Client
|
||||
import sys
|
||||
|
||||
pgm_version = "1.2.4"
|
||||
pgm_version = "1.2.5"
|
||||
CMD_LIST = {}
|
||||
module_dir = __path__[0]
|
||||
working_dir = getcwd()
|
||||
@ -35,6 +36,9 @@ root_logger.addHandler(logging_handler)
|
||||
pyro_logger = getLogger("pyrogram")
|
||||
pyro_logger.setLevel(CRITICAL)
|
||||
pyro_logger.addHandler(logging_handler)
|
||||
file_handler = FileHandler(filename="pagermaid.log.txt", mode="w", encoding="utf-8")
|
||||
file_handler.setFormatter(Formatter(logging_format))
|
||||
root_logger.addHandler(file_handler)
|
||||
basicConfig(level=DEBUG if Config.DEBUG else INFO)
|
||||
logs.setLevel(DEBUG if Config.DEBUG else INFO)
|
||||
|
||||
|
@ -35,6 +35,7 @@ def move_plugin(file_path):
|
||||
|
||||
async def download(name):
|
||||
html = await client.get(f'{Config.GIT_SOURCE}{name}/main.py')
|
||||
assert html.status_code == 200
|
||||
with open(f'plugins{sep}{name}.py', mode='wb') as f:
|
||||
f.write(html.text.encode('utf-8'))
|
||||
return f'plugins{sep}{name}.py'
|
||||
@ -107,15 +108,16 @@ async def plugin(message: Message):
|
||||
if x["name"] == i:
|
||||
if (float(x["version"]) - float(plugin_version)) <= 0:
|
||||
no_need_list.append(i)
|
||||
temp = False
|
||||
break
|
||||
else:
|
||||
remove_plugin(i)
|
||||
await download(i)
|
||||
try:
|
||||
await download(i)
|
||||
except AssertionError:
|
||||
break
|
||||
update_version(i, x["version"])
|
||||
success_list.append(i)
|
||||
temp = False
|
||||
break
|
||||
temp = False
|
||||
break
|
||||
if temp:
|
||||
failed_list.append(i)
|
||||
text = f"<b>{lang('apt_name')}</b>\n\n"
|
||||
@ -274,7 +276,10 @@ async def plugin(message: Message):
|
||||
plugin_directory = f"{working_dir}{sep}plugins{sep}"
|
||||
for i in need_update_list:
|
||||
remove_plugin(i)
|
||||
await download(i)
|
||||
try:
|
||||
await download(i)
|
||||
except AssertionError:
|
||||
continue
|
||||
with open(f"{plugin_directory}version.json", "r", encoding="utf-8") as f:
|
||||
version_json = json.load(f)
|
||||
for m in plugin_online:
|
||||
|
@ -3,7 +3,7 @@ import sentry_sdk
|
||||
from subprocess import run, PIPE
|
||||
from time import time
|
||||
|
||||
from pyrogram.errors import Unauthorized
|
||||
from pyrogram.errors import Unauthorized, UsernameInvalid
|
||||
|
||||
from pagermaid import Config
|
||||
from pagermaid.enums import Client, Message
|
||||
@ -14,7 +14,7 @@ from pagermaid.single_utils import safe_remove
|
||||
def sentry_before_send(event, hint):
|
||||
global sentry_sdk_report_time
|
||||
exc_info = hint.get("exc_info")
|
||||
if exc_info and isinstance(exc_info[1], Unauthorized):
|
||||
if exc_info and isinstance(exc_info[1], (Unauthorized, UsernameInvalid)):
|
||||
# The user has been deleted/deactivated or session revoked
|
||||
safe_remove('pagermaid.session')
|
||||
exit(1)
|
||||
|
@ -2,13 +2,15 @@ import io
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
from os.path import exists, sep
|
||||
from sys import exit
|
||||
from platform import node
|
||||
from getpass import getuser
|
||||
|
||||
from pagermaid import bot
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import attach_log, execute, Message, lang
|
||||
from pagermaid.enums import Message
|
||||
from pagermaid.services import bot
|
||||
from pagermaid.utils import attach_log, execute, lang, upload_attachment
|
||||
|
||||
|
||||
@listener(is_plugin=False, command="sh",
|
||||
@ -95,6 +97,21 @@ async def sh_eval(message: Message):
|
||||
await message.edit(final_output)
|
||||
|
||||
|
||||
@listener(is_plugin=False, command="send_log",
|
||||
need_admin=True,
|
||||
description=lang("send_log_des"))
|
||||
async def send_log(message: Message):
|
||||
""" Send log to a chat. """
|
||||
if not exists("pagermaid.log.txt"):
|
||||
return await message.edit(lang("send_log_not_found"))
|
||||
await upload_attachment("pagermaid.log.txt",
|
||||
message.chat.id,
|
||||
message.reply_to_message_id,
|
||||
thumb=f"pagermaid{sep}assets{sep}logo.jpg",
|
||||
caption=lang("send_log_caption"))
|
||||
await message.safe_delete()
|
||||
|
||||
|
||||
async def aexec(code, event, client):
|
||||
exec(
|
||||
(
|
||||
|
Loading…
Reference in New Issue
Block a user