mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
fix 0.0.5.1
This commit is contained in:
parent
c6eaf435f2
commit
058f0885f7
@ -190,10 +190,11 @@ def _get_plugin_status() -> MessageSegment:
|
|||||||
return image(b64=A.pic2bs4())
|
return image(b64=A.pic2bs4())
|
||||||
|
|
||||||
|
|
||||||
async def update_member_info(group_id: int) -> bool:
|
async def update_member_info(group_id: int, remind_superuser: bool = False) -> bool:
|
||||||
"""
|
"""
|
||||||
更新群成员信息
|
更新群成员信息
|
||||||
:param group_id: 群号
|
:param group_id: 群号
|
||||||
|
:param remind_superuser: 失败信息提醒超级用户
|
||||||
"""
|
"""
|
||||||
bot = get_bot()
|
bot = get_bot()
|
||||||
_group_user_list = await bot.get_group_member_list(group_id=group_id)
|
_group_user_list = await bot.get_group_member_list(group_id=group_id)
|
||||||
@ -262,7 +263,7 @@ async def update_member_info(group_id: int) -> bool:
|
|||||||
logger.info(f"退群用户{del_user} 所属{group_id} 已删除")
|
logger.info(f"退群用户{del_user} 所属{group_id} 已删除")
|
||||||
else:
|
else:
|
||||||
logger.info(f"退群用户{del_user} 所属{group_id} 删除失败")
|
logger.info(f"退群用户{del_user} 所属{group_id} 删除失败")
|
||||||
if _error_member_list:
|
if _error_member_list and remind_superuser:
|
||||||
result = ""
|
result = ""
|
||||||
for error_user in _error_member_list:
|
for error_user in _error_member_list:
|
||||||
result += error_user
|
result += error_user
|
||||||
|
|||||||
@ -45,7 +45,7 @@ async def _():
|
|||||||
all_group = [x.group_id for x in await GroupInfo.get_all_group()]
|
all_group = [x.group_id for x in await GroupInfo.get_all_group()]
|
||||||
for g in gl:
|
for g in gl:
|
||||||
if g not in all_group:
|
if g not in all_group:
|
||||||
await update_member_info(g)
|
await update_member_info(g, False)
|
||||||
logger.info(f"快速更新群信息以及权限:{g}")
|
logger.info(f"快速更新群信息以及权限:{g}")
|
||||||
except (IndexError, ConnectionDoesNotExistError):
|
except (IndexError, ConnectionDoesNotExistError):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@ -121,7 +121,6 @@ def init_plugins_settings(data_path: str):
|
|||||||
with open(plugins2config_file, "w", encoding="utf8") as wf:
|
with open(plugins2config_file, "w", encoding="utf8") as wf:
|
||||||
round_trip_dump(_data, wf)
|
round_trip_dump(_data, wf)
|
||||||
logger.info(f"已成功加载 {len(plugins2settings_manager.get_data())} 个非限制插件.")
|
logger.info(f"已成功加载 {len(plugins2settings_manager.get_data())} 个非限制插件.")
|
||||||
print(admin_manager)
|
|
||||||
|
|
||||||
|
|
||||||
def init_plugins_cd_limit(data_path):
|
def init_plugins_cd_limit(data_path):
|
||||||
|
|||||||
@ -29,6 +29,7 @@ from .data_source import (
|
|||||||
gen_message,
|
gen_message,
|
||||||
check_local_exists_or_download,
|
check_local_exists_or_download,
|
||||||
add_data_to_database,
|
add_data_to_database,
|
||||||
|
get_setu_count
|
||||||
)
|
)
|
||||||
from nonebot.adapters.cqhttp.exception import ActionFailed
|
from nonebot.adapters.cqhttp.exception import ActionFailed
|
||||||
from configs.config import ONLY_USE_LOCAL_SETU, WITHDRAW_SETU_TIME, NICKNAME
|
from configs.config import ONLY_USE_LOCAL_SETU, WITHDRAW_SETU_TIME, NICKNAME
|
||||||
@ -237,8 +238,8 @@ async def send_setu_handle(
|
|||||||
await matcher.finish("咳咳咳,虽然我很可爱,但是我木有自己的色图~~~有的话记得发我一份呀")
|
await matcher.finish("咳咳咳,虽然我很可爱,但是我木有自己的色图~~~有的话记得发我一份呀")
|
||||||
# 本地先拿图,下载失败补上去
|
# 本地先拿图,下载失败补上去
|
||||||
setu_list, code = None, 200
|
setu_list, code = None, 200
|
||||||
msg_id = None
|
setu_count = await get_setu_count(r18)
|
||||||
if not ONLY_USE_LOCAL_SETU and tags:
|
if (not ONLY_USE_LOCAL_SETU and tags) or setu_count <= 0:
|
||||||
# 先尝试获取在线图片
|
# 先尝试获取在线图片
|
||||||
urls, text_list, add_databases_list, code = await get_setu_urls(
|
urls, text_list, add_databases_list, code = await get_setu_urls(
|
||||||
tags, num, r18, command
|
tags, num, r18, command
|
||||||
@ -288,9 +289,9 @@ async def send_setu_handle(
|
|||||||
except ActionFailed:
|
except ActionFailed:
|
||||||
await matcher.finish("坏了,这张图色过头了,我自己看看就行了!", at_sender=True)
|
await matcher.finish("坏了,这张图色过头了,我自己看看就行了!", at_sender=True)
|
||||||
return
|
return
|
||||||
# 本地无图 或 超过上下限
|
|
||||||
if code != 200:
|
if code != 200:
|
||||||
await matcher.finish("网络连接失败...", at_sender=True)
|
await matcher.finish("网络连接失败...", at_sender=True)
|
||||||
|
# 本地无图
|
||||||
if setu_list is None:
|
if setu_list is None:
|
||||||
setu_list, code = await get_setu_list(tags=tags, r18=r18)
|
setu_list, code = await get_setu_list(tags=tags, r18=r18)
|
||||||
if code != 200:
|
if code != 200:
|
||||||
|
|||||||
@ -210,6 +210,14 @@ def get_luoxiang(impression):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
async def get_setu_count(r18: int) -> int:
|
||||||
|
"""
|
||||||
|
获取色图数量
|
||||||
|
:param r18: r18类型
|
||||||
|
"""
|
||||||
|
return await Setu.get_image_count(r18)
|
||||||
|
|
||||||
|
|
||||||
async def find_img_index(img_url, user_id):
|
async def find_img_index(img_url, user_id):
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
async with session.get(img_url, proxy=get_local_proxy(), timeout=5) as res:
|
async with session.get(img_url, proxy=get_local_proxy(), timeout=5) as res:
|
||||||
|
|||||||
@ -157,6 +157,10 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
|
|||||||
async def generate_statistics_img(
|
async def generate_statistics_img(
|
||||||
data: dict, arg: str, name: str, plugin: str, day_index: int
|
data: dict, arg: str, name: str, plugin: str, day_index: int
|
||||||
):
|
):
|
||||||
|
try:
|
||||||
|
plugin = plugins2settings_manager.get_plugin_data(plugin)['cmd'][0]
|
||||||
|
except (KeyError, IndexError):
|
||||||
|
pass
|
||||||
bar_graph = None
|
bar_graph = None
|
||||||
if arg == "day_statistics":
|
if arg == "day_statistics":
|
||||||
bar_graph = await init_bar_graph(data, f"{name} 日功能调用统计")
|
bar_graph = await init_bar_graph(data, f"{name} 日功能调用统计")
|
||||||
@ -180,7 +184,6 @@ async def generate_statistics_img(
|
|||||||
count.append(0)
|
count.append(0)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
print(data[str(week_lst[i])][plugin])
|
|
||||||
count.append(data[str(week_lst[i])][plugin])
|
count.append(data[str(week_lst[i])][plugin])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
count.append(0)
|
count.append(0)
|
||||||
|
|||||||
@ -640,6 +640,7 @@ class CreateMat:
|
|||||||
_max_value = ceil(
|
_max_value = ceil(
|
||||||
_max_value / eval("1" + "0" * (len(str(_max_value)) - 1))
|
_max_value / eval("1" + "0" * (len(str(_max_value)) - 1))
|
||||||
) * eval("1" + "0" * (len(str(_max_value)) - 1))
|
) * eval("1" + "0" * (len(str(_max_value)) - 1))
|
||||||
|
_max_value = _max_value if _max_value >= 10 else 100
|
||||||
_step = int(_max_value / 10)
|
_step = int(_max_value / 10)
|
||||||
for i in range(_step, _max_value + _step, _step):
|
for i in range(_step, _max_value + _step, _step):
|
||||||
_y_index.append(i)
|
_y_index.append(i)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user