🐛⬆️ Fix edit inlinebot command message error and eval support dev file (#163)

🐛 部分插件不再处理通过 inlinebot 发送的消息
 eval 支持通过文件授权开发者权限
⬆️ 升级 sentry 依赖包
This commit is contained in:
Xtao_dada 2022-01-04 19:34:14 +08:00 committed by GitHub
parent babbc1c44c
commit 155c774de6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 11 deletions

View File

@ -457,7 +457,7 @@ eval_channel: Something went wrong ~ The current PagerMaid-Modify configuration
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.'
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.'
# restart
restart_des: Restart PagerMaid-Modify
restart_processing: Try to restart PagerMaid-Modify.

View File

@ -472,7 +472,7 @@ eval_channel: 出错了呜呜呜 ~ 当前 PagerMaid-Modify 的配置禁止在频
eval_success: 远程执行 Python 命令
eval_need_dev: '**请注意:此命令可以直接操作您的账户**
此命令仅适用于开发者,如果您知道您在做什么的话,请手动在 Redis 数据库配置 dev 项为任意值。'
此命令仅适用于开发者,如果您知道您在做什么的话,请手动在 Redis 数据库配置 dev 项为任意值或者在 data 文件夹下创建 dev 文件。'
## restart
restart_des: 使 PagerMaid-Modify 重新启动
restart_processing: 尝试重新启动 PagerMaid-Modify.

View File

@ -457,7 +457,7 @@ eval_channel: Error不能在頻道執行指令。
eval_success: 執行 Python 指令
eval_need_dev: '**請注意:此命令可以直接操作您的賬戶**
此命令僅適用於開發者,如果您知道您在做什麼的話,請手動在 Redis 數據庫配置 dev 項為任意值。'
此命令僅適用於開發者,如果您知道您在做什麼的話,請手動在 Redis 數據庫配置 dev 項為任意值或者在 data 文件夾下創建 dev 文件。'
# restart
restart_des: 重新啟動
restart_processing: 嘗試重新啟動

View File

@ -39,6 +39,7 @@ def listener(**args):
owners_only = args.get("owners_only", False)
admins_only = args.get("admins_only", False)
groups_only = args.get("groups_only", False)
support_inline = args.get("support_inline", False)
if command is not None:
if command in help_messages:
raise ValueError(f"{lang('error_prefix')} {lang('command')} \"{command}\" {lang('has_reg')}")
@ -67,6 +68,8 @@ def listener(**args):
del args['admins_only']
if 'groups_only' in args:
del args['groups_only']
if 'support_inline' in args:
del args['support_inline']
def decorator(function):
@ -86,6 +89,9 @@ def listener(**args):
if groups_only:
if not context.is_group:
return
# filter inline bot msg
if not support_inline and context.via_bot_id:
return
try:
analytic = True
try:

View File

@ -1,9 +1,10 @@
""" System related utilities for PagerMaid to integrate into the system. """
import io, sys, traceback
from os.path import exists
from platform import node
from getpass import getuser
from os import geteuid
from os import geteuid, sep
from requests import head
from asyncio import sleep
from requests.exceptions import MissingSchema, InvalidURL, ConnectionError
@ -73,12 +74,16 @@ async def sh(context):
parameters=lang('eval_parameters'))
async def sh(context):
""" Run python commands from Telegram. """
if not redis_status():
await context.edit(f"{lang('error_prefix')}{lang('redis_dis')}")
return
if not redis.get("dev"):
await context.edit(lang('eval_need_dev'))
return
dev_mode = False
# file
if exists(f"data{sep}dev"):
dev_mode = True
# redis
if redis_status():
if redis.get("dev"):
dev_mode = True
if not dev_mode:
return await context.edit(lang('eval_need_dev'))
if context.is_channel and not context.is_group:
await context.edit(lang('eval_channel'))
return

View File

@ -35,6 +35,6 @@ cheroot>=8.5.2
python-socks[asyncio]>=1.2.4
certifi>=2021.5.30
magic_google>=0.2.9
sentry-sdk>=1.4.1
sentry-sdk>=1.5.1
analytics-python>=1.4.0
beautifulsoup4>=4.9.3