mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-01 09:39:59 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc34cd541a | ||
|
|
8090ebe8ce | ||
|
|
f87c14595f | ||
|
|
39bb5a9ab9 | ||
|
|
f754ad1c76 | ||
|
|
37e1a06528 | ||
|
|
7096d258db |
@@ -95,8 +95,8 @@ async def check_update(bot: Bot) -> int:
|
|||||||
height = len(update_info.split('\n')) * 24
|
height = len(update_info.split('\n')) * 24
|
||||||
for m in update_info.split('\n'):
|
for m in update_info.split('\n'):
|
||||||
if len(m) * 20 > width:
|
if len(m) * 20 > width:
|
||||||
width = len(m) * 17
|
width = len(m) * 24
|
||||||
A = CreateImg(800, height, font_size=20)
|
A = CreateImg(width, height, font_size=20)
|
||||||
A.text((10, 10), update_info)
|
A.text((10, 10), update_info)
|
||||||
A.save(f'{IMAGE_PATH}/update_info.png')
|
A.save(f'{IMAGE_PATH}/update_info.png')
|
||||||
return 200
|
return 200
|
||||||
@@ -130,7 +130,7 @@ def _file_handle(latest_version: str):
|
|||||||
tf = tarfile.open(zhenxun_latest_tar_gz)
|
tf = tarfile.open(zhenxun_latest_tar_gz)
|
||||||
tf.extractall(temp_dir)
|
tf.extractall(temp_dir)
|
||||||
logger.info("解压真寻文件压缩包完成....")
|
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_file = Path(zhenxun_latest_file) / "update_info.json"
|
||||||
update_info = json.load(open(update_info_file, "r", encoding="utf8"))
|
update_info = json.load(open(update_info_file, "r", encoding="utf8"))
|
||||||
update_file = update_info["update_file"]
|
update_file = update_info["update_file"]
|
||||||
|
|||||||
+13
-9
@@ -7,6 +7,7 @@ from nonebot.adapters.cqhttp import (
|
|||||||
MessageEvent,
|
MessageEvent,
|
||||||
PrivateMessageEvent,
|
PrivateMessageEvent,
|
||||||
GroupMessageEvent,
|
GroupMessageEvent,
|
||||||
|
PokeNotifyEvent
|
||||||
)
|
)
|
||||||
from configs.config import (
|
from configs.config import (
|
||||||
BAN_RESULT,
|
BAN_RESULT,
|
||||||
@@ -132,7 +133,7 @@ _flmt_c = FreqLimiter(CHECK_NOTICE_INFO_CD)
|
|||||||
@run_preprocessor
|
@run_preprocessor
|
||||||
async def _(matcher: Matcher, bot: Bot, event: MessageEvent, state: T_State):
|
async def _(matcher: Matcher, bot: Bot, event: MessageEvent, state: T_State):
|
||||||
if (
|
if (
|
||||||
not isinstance(event, MessageEvent)
|
(not isinstance(event, MessageEvent) and matcher.module != "poke")
|
||||||
or await BanUser.is_ban(event.user_id)
|
or await BanUser.is_ban(event.user_id)
|
||||||
or str(event.user_id) in bot.config.superusers
|
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:
|
except ActionFailed:
|
||||||
pass
|
pass
|
||||||
raise IgnoredException("权限不足")
|
raise IgnoredException("权限不足")
|
||||||
if module in plugins2info_dict.keys():
|
if module in plugins2info_dict.keys() and matcher.priority not in [1, 9]:
|
||||||
if isinstance(event, GroupMessageEvent):
|
# 戳一戳单独判断
|
||||||
|
if isinstance(event, GroupMessageEvent) or (isinstance(event, PokeNotifyEvent) and event.group_id):
|
||||||
# 群权限
|
# 群权限
|
||||||
if plugins2info_dict[module]["level"] > group_manager.get_group_level(
|
if plugins2info_dict[module]["level"] > group_manager.get_group_level(
|
||||||
str(event.group_id)
|
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)):
|
if not group_manager.get_plugin_status(module, str(event.group_id)):
|
||||||
try:
|
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)
|
_flmt_s.start_cd(event.group_id)
|
||||||
await bot.send_group_msg(
|
await bot.send_group_msg(
|
||||||
group_id=event.group_id, message="该群未开启此功能.."
|
group_id=event.group_id, message="该群未开启此功能.."
|
||||||
@@ -230,12 +232,14 @@ async def _(matcher: Matcher, bot: Bot, event: MessageEvent, state: T_State):
|
|||||||
pass
|
pass
|
||||||
raise IgnoredException("该插件在私聊中已被禁用...")
|
raise IgnoredException("该插件在私聊中已被禁用...")
|
||||||
# 维护
|
# 维护
|
||||||
if not group_manager.get_plugin_status(
|
if not group_manager.get_plugin_status(module, block_type="all"):
|
||||||
module, block_type="all"
|
if isinstance(
|
||||||
) and not group_manager.check_group_is_white(event.group_id):
|
event, GroupMessageEvent
|
||||||
|
) and group_manager.check_group_is_white(event.group_id):
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
if _flmt_c.check(event.group_id):
|
if _flmt_c.check(event.user_id):
|
||||||
_flmt_c.start_cd(event.group_id)
|
_flmt_c.start_cd(event.user_id)
|
||||||
if isinstance(event, GroupMessageEvent):
|
if isinstance(event, GroupMessageEvent):
|
||||||
await bot.send_group_msg(
|
await bot.send_group_msg(
|
||||||
group_id=event.group_id, message="此功能正在维护..."
|
group_id=event.group_id, message="此功能正在维护..."
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ __plugin_usage__ = (
|
|||||||
|
|
||||||
_flmt = FreqLimiter(1)
|
_flmt = FreqLimiter(1)
|
||||||
|
|
||||||
|
if '色图' in IMAGE_DIR_LIST:
|
||||||
|
IMAGE_DIR_LIST.remove('色图')
|
||||||
|
|
||||||
cmd = set(IMAGE_DIR_LIST)
|
cmd = set(IMAGE_DIR_LIST)
|
||||||
|
|
||||||
# print(cmd)
|
# print(cmd)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"update_file": [
|
"update_file": [
|
||||||
".env.dev",
|
|
||||||
"configs/config.py",
|
"configs/config.py",
|
||||||
"configs/path_config.py",
|
"configs/path_config.py",
|
||||||
"plugins/aconfig",
|
"plugins/aconfig",
|
||||||
|
|||||||
Reference in New Issue
Block a user