mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-09-29 00:32:06 +08:00
修复群聊数据无法初始化
This commit is contained in:
@@ -28,7 +28,7 @@ ICON_PATH = IMAGE_PATH / "other"
|
||||
GROUP_HELP_PATH = DATA_PATH / "group_help"
|
||||
|
||||
|
||||
async def group_current_status(group_id: int) -> str:
|
||||
async def group_current_status(group_id: str) -> str:
|
||||
"""
|
||||
说明:
|
||||
获取当前群聊所有通知的开关
|
||||
@@ -144,7 +144,7 @@ def change_global_task_status(cmd: str) -> str:
|
||||
return f"已 {status} 全局{_cmd}"
|
||||
|
||||
|
||||
async def change_group_switch(cmd: str, group_id: int, is_super: bool = False) -> str:
|
||||
async def change_group_switch(cmd: str, group_id: str, is_super: bool = False) -> str:
|
||||
"""
|
||||
说明:
|
||||
修改群功能状态
|
||||
@@ -373,7 +373,7 @@ async def update_member_info(
|
||||
return True
|
||||
|
||||
|
||||
def set_group_bot_status(group_id: int, status: bool) -> str:
|
||||
def set_group_bot_status(group_id: str, status: bool) -> str:
|
||||
"""
|
||||
说明:
|
||||
设置群聊bot开关状态
|
||||
|
||||
@@ -130,15 +130,15 @@ async def _():
|
||||
|
||||
@group_task_status.handle()
|
||||
async def _(event: GroupMessageEvent):
|
||||
await group_task_status.send(image(b64=await group_current_status(event.group_id)))
|
||||
await group_task_status.send(image(b64=await group_current_status(str(event.group_id))))
|
||||
|
||||
|
||||
@group_status.handle()
|
||||
async def _(event: GroupMessageEvent, reg_group: Tuple[Any, ...] = RegexGroup()):
|
||||
cmd = reg_group[0]
|
||||
if cmd == "休息吧":
|
||||
msg = set_group_bot_status(event.group_id, False)
|
||||
msg = set_group_bot_status(str(event.group_id), False)
|
||||
else:
|
||||
msg = set_group_bot_status(event.group_id, True)
|
||||
msg = set_group_bot_status(str(event.group_id), True)
|
||||
await group_status.send(msg)
|
||||
logger.info(f"使用总开关命令: {cmd}", cmd, event.user_id, event.group_id)
|
||||
|
||||
@@ -50,7 +50,7 @@ async def _(
|
||||
gl = [
|
||||
g["group_id"]
|
||||
for g in await bot.get_group_list()
|
||||
if group_manager.check_group_task_status(g["group_id"], "broadcast")
|
||||
if group_manager.check_group_task_status(str(g["group_id"]), "broadcast")
|
||||
]
|
||||
g_cnt = len(gl)
|
||||
cnt = 0
|
||||
|
||||
@@ -95,7 +95,7 @@ async def _(bot: Bot, event: GroupIncreaseNoticeEvent):
|
||||
data = plugins2settings_manager.get_data()
|
||||
for plugin in data.keys():
|
||||
if not data[plugin].default_status:
|
||||
group_manager.block_plugin(plugin, event.group_id)
|
||||
group_manager.block_plugin(plugin, str(event.group_id))
|
||||
admin_default_auth = Config.get_config(
|
||||
"admin_bot_manage", "ADMIN_DEFAULT_AUTH"
|
||||
)
|
||||
|
||||
@@ -116,7 +116,7 @@ async def _(bot: Bot, event: MessageEvent, arg: Message = CommandArg()):
|
||||
if len(msg) < 2:
|
||||
await add_group_level.finish("缺失参数...")
|
||||
if is_number(msg[0]) and is_number(msg[1]):
|
||||
group_id = int(msg[0])
|
||||
group_id = str(msg[0])
|
||||
level = int(msg[1])
|
||||
else:
|
||||
await add_group_level.finish("参数错误...群号和等级必须是数字..")
|
||||
@@ -125,7 +125,7 @@ async def _(bot: Bot, event: MessageEvent, arg: Message = CommandArg()):
|
||||
await add_group_level.send("修改成功...", at_sender=True)
|
||||
if level > -1:
|
||||
await bot.send_group_msg(
|
||||
group_id=group_id, message=f"管理员修改了此群权限:{old_level} -> {level}"
|
||||
group_id=int(group_id), message=f"管理员修改了此群权限:{old_level} -> {level}"
|
||||
)
|
||||
logger.info(f"修改群权限:{level}", "修改群权限", event.user_id, target=group_id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user