Compare commits

...
11 Commits
Author SHA1 Message Date
hibiki 6a8eb9e67a update admin_manager 2021-08-18 10:06:06 +08:00
hibiki 8b7adf0a6a update pa 2021-08-18 09:56:53 +08:00
hibiki 973182c27c update setu 2021-08-18 02:04:26 +08:00
hibiki 0dced0bc90 update check 2021-08-18 01:47:21 +08:00
hibiki fc34cd541a code 2021-08-18 01:33:43 +08:00
hibiki 8090ebe8ce update hook 2021-08-18 01:29:36 +08:00
hibiki f87c14595f update hook 2021-08-18 00:44:03 +08:00
hibiki 39bb5a9ab9 update check_zhenxun_update 2021-08-18 00:26:11 +08:00
hibiki f754ad1c76 update code 2021-08-18 00:17:57 +08:00
hibiki 37e1a06528 update checkup 2021-08-18 00:14:55 +08:00
hibiki 7096d258db update code 2021-08-17 23:49:07 +08:00
7 changed files with 47 additions and 27 deletions
+1
View File
@@ -687,6 +687,7 @@ python bot.py
* 我有一个朋友功能,当艾特一个对象时,‘朋友’改为艾特对象的群名片或昵称
* 修复‘上传/删除/移动图片’目录不正确
* 修复天气功能,当城市名在‘天气’后时报错
* 修复配置INITIAL_SETU_PROBABILITY不生效
### 2021/8/10
+1 -1
View File
@@ -53,7 +53,7 @@ async def remind_status(group: int, name: str, flag: bool) -> str:
else:
rst = "关闭"
if not await GroupRemind.get_status(group, name):
return f"该群已经{rst}过 {_name},请勿重复开启!"
return f"该群已经{rst}过 {_name},请勿重复关闭!"
if await GroupRemind.set_status(group, name, flag):
info = command_info_dt[_name] if command_info_dt.get(_name) else ""
if info:
+3 -3
View File
@@ -53,9 +53,7 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
change_group_switch(_cmd, int(block_type), True)
group_name = (await bot.get_group_info(group_id=int(block_type)))['group_name']
await switch_rule.send(f'已禁用群聊 {group_name}({block_type}) 的 {_cmd[2:]} 功能')
else:
if block_type not in ['all', 'private', 'group', 'a', 'p', 'g']:
block_type = 'all'
elif block_type in ['all', 'private', 'group', 'a', 'p', 'g']:
block_type = 'all' if block_type == 'a' else block_type
block_type = 'private' if block_type == 'p' else block_type
block_type = 'group' if block_type == 'g' else block_type
@@ -66,6 +64,8 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
await switch_rule.send(f'已在私聊中{_cmd[:2]}功能:{_cmd[2:]}')
else:
await switch_rule.send(f'已在群聊中{_cmd[:2]}功能:{_cmd[2:]}')
else:
await switch_rule.finish('格式错误:关闭[功能] [group]/[p/g]')
logger.info(
f'USER {event.user_id} 使用功能管理命令 {state["_prefix"]["raw_command"]} | {block_type}'
)
+3 -3
View File
@@ -95,8 +95,8 @@ async def check_update(bot: Bot) -> int:
height = len(update_info.split('\n')) * 24
for m in update_info.split('\n'):
if len(m) * 20 > width:
width = len(m) * 17
A = CreateImg(800, height, font_size=20)
width = len(m) * 18
A = CreateImg(width, height, font_size=20)
A.text((10, 10), update_info)
A.save(f'{IMAGE_PATH}/update_info.png')
return 200
@@ -130,7 +130,7 @@ def _file_handle(latest_version: str):
tf = tarfile.open(zhenxun_latest_tar_gz)
tf.extractall(temp_dir)
logger.info("解压真寻文件压缩包完成....")
zhenxun_latest_file = Path(temp_dir) / f"zhenxun_bot-{latest_version[1:]}"
zhenxun_latest_file = Path(temp_dir) / os.listdir(temp_dir)[0]
update_info_file = Path(zhenxun_latest_file) / "update_info.json"
update_info = json.load(open(update_info_file, "r", encoding="utf8"))
update_file = update_info["update_file"]
+13 -9
View File
@@ -7,6 +7,7 @@ from nonebot.adapters.cqhttp import (
MessageEvent,
PrivateMessageEvent,
GroupMessageEvent,
PokeNotifyEvent
)
from configs.config import (
BAN_RESULT,
@@ -132,7 +133,7 @@ _flmt_c = FreqLimiter(CHECK_NOTICE_INFO_CD)
@run_preprocessor
async def _(matcher: Matcher, bot: Bot, event: MessageEvent, state: T_State):
if (
not isinstance(event, MessageEvent)
(not isinstance(event, MessageEvent) and matcher.module != "poke")
or await BanUser.is_ban(event.user_id)
or str(event.user_id) in bot.config.superusers
):
@@ -167,8 +168,9 @@ async def _(matcher: Matcher, bot: Bot, event: MessageEvent, state: T_State):
except ActionFailed:
pass
raise IgnoredException("权限不足")
if module in plugins2info_dict.keys():
if isinstance(event, GroupMessageEvent):
if module in plugins2info_dict.keys() and matcher.priority not in [1, 9]:
# 戳一戳单独判断
if isinstance(event, GroupMessageEvent) or (isinstance(event, PokeNotifyEvent) and event.group_id):
# 群权限
if plugins2info_dict[module]["level"] > group_manager.get_group_level(
str(event.group_id)
@@ -185,7 +187,7 @@ async def _(matcher: Matcher, bot: Bot, event: MessageEvent, state: T_State):
# 插件状态
if not group_manager.get_plugin_status(module, str(event.group_id)):
try:
if _flmt_s.check(event.group_id):
if module != "poke" and _flmt_s.check(event.group_id):
_flmt_s.start_cd(event.group_id)
await bot.send_group_msg(
group_id=event.group_id, message="该群未开启此功能.."
@@ -230,12 +232,14 @@ async def _(matcher: Matcher, bot: Bot, event: MessageEvent, state: T_State):
pass
raise IgnoredException("该插件在私聊中已被禁用...")
# 维护
if not group_manager.get_plugin_status(
module, block_type="all"
) and not group_manager.check_group_is_white(event.group_id):
if not group_manager.get_plugin_status(module, block_type="all"):
if isinstance(
event, GroupMessageEvent
) and group_manager.check_group_is_white(event.group_id):
return
try:
if _flmt_c.check(event.group_id):
_flmt_c.start_cd(event.group_id)
if _flmt_c.check(event.user_id):
_flmt_c.start_cd(event.user_id)
if isinstance(event, GroupMessageEvent):
await bot.send_group_msg(
group_id=event.group_id, message="此功能正在维护..."
+26 -10
View File
@@ -27,12 +27,16 @@ __plugin_usage__ = (
_flmt = FreqLimiter(1)
if "色图" in IMAGE_DIR_LIST:
IMAGE_DIR_LIST.remove("色图")
cmd = set(IMAGE_DIR_LIST)
# print(cmd)
send_img = on_command("img", aliases=cmd, priority=5, block=True)
pa = on_keyword({"爬", "爪巴"}, priority=1, block=True)
pa = on_keyword({"丢人爬", "爪巴"}, priority=5, block=True)
pa_reg = on_regex("^爬$", priority=5, block=True)
search_img = on_regex(".*[份|发|张|个|次|点]图.*?", priority=6, block=True)
search_url = "https://api.fantasyzone.cc/tu/search.php"
@@ -71,15 +75,27 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
@pa.handle()
async def _(bot: Bot, event: MessageEvent, state: T_State):
if isinstance(event, GroupMessageEvent):
if await GroupRemind.get_status(event.group_id, "pa"):
msg = get_message_text(event.json())
if not msg or str(event.get_message()[:2]) in ["开启", "关闭"]:
return
if not _flmt.check(event.user_id):
return
_flmt.start_cd(event.user_id)
await pa.finish(image(random.choice(os.listdir(IMAGE_PATH + "pa")), "pa"))
if isinstance(event, GroupMessageEvent) and not await GroupRemind.get_status(
event.group_id, "pa"
):
return
msg = get_message_text(event.json())
if not msg or str(event.get_message()[:2]) in ["开启", "关闭"]:
return
if _flmt.check(event.user_id):
_flmt.start_cd(event.user_id)
await pa.finish(image(random.choice(os.listdir(IMAGE_PATH + "pa")), "pa"))
@pa_reg.handle()
async def _(bot: Bot, event: MessageEvent, state: T_State):
if isinstance(event, GroupMessageEvent) and not await GroupRemind.get_status(
event.group_id, "pa"
):
return
if _flmt.check(event.user_id):
_flmt.start_cd(event.user_id)
await pa.finish(image(random.choice(os.listdir(IMAGE_PATH + "pa")), "pa"))
num_key = {
-1
View File
@@ -1,6 +1,5 @@
{
"update_file": [
".env.dev",
"configs/config.py",
"configs/path_config.py",
"plugins/aconfig",