🐛 修复生命周期钩子函数的问题
This commit is contained in:
BIN
src/libs/ly_api_windows_amd64.dll
Normal file
BIN
src/libs/ly_api_windows_amd64.dll
Normal file
Binary file not shown.
@ -19,7 +19,7 @@ from src.utils.base.ly_typing import T_Bot, T_MessageEvent
|
||||
from src.utils.message.message import MarkdownMessage as md, broadcast_to_superusers
|
||||
# from src.liteyuki.core import Reloader
|
||||
from src.utils import event as event_utils, satori_utils
|
||||
from liteyuki.core.spawn_process import chan_in_spawn
|
||||
from liteyuki.core.spawn_process import chan_in_spawn_nb
|
||||
|
||||
from .api import update_liteyuki
|
||||
from liteyuki.bot import get_bot
|
||||
|
@ -1,7 +1,6 @@
|
||||
import multiprocessing
|
||||
|
||||
from nonebot.plugin import PluginMetadata
|
||||
from liteyuki.plugin import get_loaded_plugins
|
||||
from .rt_guide import *
|
||||
from .crt_matchers import *
|
||||
|
||||
@ -16,6 +15,4 @@ __plugin_meta__ = PluginMetadata(
|
||||
"toggleable" : True,
|
||||
"default_enable": True,
|
||||
}
|
||||
)
|
||||
|
||||
print("Loaded plugins:", len(get_loaded_plugins()))
|
||||
)
|
@ -153,7 +153,6 @@ class Minesweeper:
|
||||
text += "\n\n"
|
||||
for i, row in enumerate(self.board):
|
||||
text += start + f"{self.NUMS[i]}" + dis*2
|
||||
print([d.value for d in row])
|
||||
for dot in row:
|
||||
if dot.mask and not dot.flagged:
|
||||
text += md.btn_cmd(self.MASK, f"minesweeper reveal {dot.row} {dot.col}")
|
||||
|
@ -146,7 +146,6 @@ def set_plugin_session_enable(event: T_MessageEvent, plugin_name: str, enable: b
|
||||
else:
|
||||
session: User = user_db.where_one(User(), "user_id = ?", str(event_utils.get_user_id(event)),
|
||||
default=User(user_id=str(event_utils.get_user_id(event))))
|
||||
print(session)
|
||||
default_enable = get_plugin_default_enable(plugin_name)
|
||||
if default_enable:
|
||||
if enable:
|
||||
|
@ -119,7 +119,6 @@ async def _(result: Arparma, event: T_MessageEvent, bot: Bot):
|
||||
ulang = Language(event_utils.get_user_id(event))
|
||||
rank_type = "user"
|
||||
duration = convert_time_to_seconds(result.other_args.get("duration", "1d"))
|
||||
print(result)
|
||||
if result.subcommands.get("rank").options.get("user"):
|
||||
rank_type = "user"
|
||||
elif result.subcommands.get("rank").options.get("group"):
|
||||
|
@ -15,7 +15,7 @@ require("nonebot_plugin_alconna")
|
||||
|
||||
|
||||
async def general_event_monitor(bot: T_Bot, event: T_MessageEvent):
|
||||
print("POST PROCESS")
|
||||
pass
|
||||
# if isinstance(bot, satori.Bot):
|
||||
# print("POST PROCESS SATORI EVENT")
|
||||
# return await satori_event_monitor(bot, event)
|
||||
|
@ -52,9 +52,9 @@ async def _(event: T_MessageEvent, bot: T_Bot):
|
||||
|
||||
@status_alc.assign("memory")
|
||||
async def _():
|
||||
print("memory")
|
||||
pass
|
||||
|
||||
|
||||
@status_alc.assign("process")
|
||||
async def _():
|
||||
print("process")
|
||||
pass
|
||||
|
@ -7,7 +7,6 @@ bot_info_router = APIRouter(prefix="/api/bot-info")
|
||||
|
||||
@device_info_router.get("/")
|
||||
async def device_info():
|
||||
print("Hello Device Info")
|
||||
return {
|
||||
"message": "Hello Device Info"
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import threading
|
||||
|
||||
from nonebot import logger
|
||||
from liteyuki.core.spawn_process import chan_in_spawn
|
||||
from liteyuki.core.spawn_process import chan_in_spawn_nb
|
||||
|
||||
|
||||
def reload(delay: float = 0.0, receiver: str = "nonebot"):
|
||||
@ -15,5 +15,5 @@ def reload(delay: float = 0.0, receiver: str = "nonebot"):
|
||||
|
||||
"""
|
||||
|
||||
chan_in_spawn.send(1, receiver)
|
||||
chan_in_spawn_nb.send(1, receiver)
|
||||
logger.info(f"Reloading LiteyukiBot({receiver})...")
|
||||
|
@ -6,10 +6,9 @@ import aiohttp
|
||||
import nonebot
|
||||
import psutil
|
||||
import requests
|
||||
from aiohttp import FormData
|
||||
|
||||
from .. import __VERSION_I__, __VERSION__, __NAME__
|
||||
from .config import load_from_yaml
|
||||
from .. import __NAME__, __VERSION_I__, __VERSION__
|
||||
|
||||
|
||||
class LiteyukiAPI:
|
||||
@ -69,6 +68,10 @@ class LiteyukiAPI:
|
||||
else:
|
||||
nonebot.logger.warning(f"Bug report is disabled: {content}")
|
||||
|
||||
def register(self):
|
||||
pass
|
||||
|
||||
|
||||
async def heartbeat_report(self):
|
||||
"""
|
||||
提交心跳,预留接口
|
||||
|
15
src/utils/extension/__init__.py
Normal file
15
src/utils/extension/__init__.py
Normal file
@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
|
||||
|
||||
@Time : 2024/8/7 下午10:40
|
||||
@Author : snowykami
|
||||
@Email : snowykami@outlook.com
|
||||
@File : __init__.py
|
||||
@Software: PyCharm
|
||||
"""
|
||||
from .lib_loader import *
|
||||
|
||||
__all__ = [
|
||||
"load_lib"
|
||||
]
|
41
src/utils/extension/lib_loader.py
Normal file
41
src/utils/extension/lib_loader.py
Normal file
@ -0,0 +1,41 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
|
||||
|
||||
@Time : 2024/8/7 下午10:40
|
||||
@Author : snowykami
|
||||
@Email : snowykami@outlook.com
|
||||
@File : lib_loader.py
|
||||
@Software: PyCharm
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import platform
|
||||
import ctypes
|
||||
|
||||
LIB_EXT = None
|
||||
PLATFORM = platform.system().lower() # linux, windows, darwin etc
|
||||
ARCH = platform.machine().lower() # x86_64/amd64 i386 i686 arm aarch64 ppc64 ppc mips sparc
|
||||
|
||||
if "linux" in PLATFORM:
|
||||
LIB_EXT = 'so'
|
||||
elif sys.platform == 'darwin':
|
||||
LIB_EXT = 'dylib'
|
||||
elif sys.platform == 'win32':
|
||||
LIB_EXT = 'dll'
|
||||
else:
|
||||
raise RuntimeError("Unsupported platform")
|
||||
|
||||
|
||||
def load_lib(lib_name: str) -> ctypes.CDLL:
|
||||
"""
|
||||
Load a dll/so/dylib library, without extension.
|
||||
Args:
|
||||
lib_name: str, path/to/library without extension
|
||||
Returns:
|
||||
xxx_{platform}_{arch}.{ext} ctypes.CDLL
|
||||
"""
|
||||
whole_path = f"{lib_name}_{PLATFORM}_{ARCH}.{LIB_EXT}"
|
||||
if not os.path.exists(whole_path):
|
||||
raise FileNotFoundError(f"Library {whole_path} not found")
|
||||
return ctypes.CDLL(whole_path)
|
Reference in New Issue
Block a user