mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-09-29 00:32:06 +08:00
* bugfix:更换数据库初始化超时路径以修复连接超时问题 * 移除部分观测链路 * 细节修改 * 权限检查细节修改2 * bugfix:修复金币懒加载造成插件金币消耗不了的问题 * bugfix:整理鉴权逻辑 * 完善缓存系统 * 优化官端使用 * bugfix:增加官机和频道的前导统一剥离,新增获取群列表自愈 * bugfix:修复导入问题
51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
from nonebot.adapters import Bot
|
|
from nonebot.plugin import PluginMetadata
|
|
from nonebot_plugin_alconna import Alconna, Arparma, on_alconna
|
|
from nonebot_plugin_session import EventSession
|
|
|
|
from zhenxun.configs.utils import PluginExtraData
|
|
from zhenxun.services.log import logger
|
|
from zhenxun.utils.enum import PluginType
|
|
from zhenxun.utils.message import MessageUtils
|
|
from zhenxun.utils.platform import PlatformUtils
|
|
from zhenxun.utils.rules import admin_check, ensure_group
|
|
|
|
__plugin_meta__ = PluginMetadata(
|
|
name="更新群组列表",
|
|
description="更新群组列表",
|
|
usage="""
|
|
更新群组的基本信息
|
|
指令:
|
|
更新群组信息
|
|
""".strip(),
|
|
extra=PluginExtraData(
|
|
author="HibiKier",
|
|
version="0.1",
|
|
plugin_type=PluginType.SUPER_AND_ADMIN,
|
|
admin_level=1,
|
|
).to_dict(),
|
|
)
|
|
|
|
|
|
_matcher = on_alconna(
|
|
Alconna("更新群组信息"),
|
|
rule=admin_check(1) & ensure_group,
|
|
priority=5,
|
|
block=True,
|
|
)
|
|
|
|
|
|
@_matcher.handle()
|
|
async def _(bot: Bot, session: EventSession, arparma: Arparma):
|
|
logger.info("更新群组信息", arparma.header_result, session=session)
|
|
try:
|
|
if PlatformUtils.get_platform_scope(bot) != "qq_client":
|
|
await MessageUtils.build_message(
|
|
"当前平台不支持旧群组信息同步,仅 OneBot 协议端可用。"
|
|
).send(reply_to=True)
|
|
return
|
|
await PlatformUtils.update_group(bot)
|
|
await MessageUtils.build_message("已经成功更新了群组信息!").send(reply_to=True)
|
|
except Exception:
|
|
await MessageUtils.build_message("更新群组信息失败!").finish(reply_to=True)
|