🐛⬆️ 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_success: execute Python commands remotely
eval_need_dev: '**Please note: This command can directly operate your account** 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
restart_des: Restart PagerMaid-Modify restart_des: Restart PagerMaid-Modify
restart_processing: Try to restart PagerMaid-Modify. restart_processing: Try to restart PagerMaid-Modify.

View File

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

View File

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

View File

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

View File

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

View File

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