mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2024-11-24 21:15:04 +08:00
🐛 修复一些细节小问题
This commit is contained in:
parent
c2cb416b4e
commit
4a5dd1f727
@ -25,6 +25,9 @@
|
||||
### 感谢
|
||||
- 所有贡献者们
|
||||
|
||||
### 参考
|
||||
- [nonebot-plugin-uninfo](https://github.com/RF-Tar-Railt/nonebot-plugin-uninfo)为会话部分用户信息提供了参考
|
||||
|
||||
|
||||
[OneBot]: https://img.shields.io/badge/OneBot-11/12-blue?style=for-the-badge
|
||||
|
||||
|
2248
docs/pnpm-lock.yaml
2248
docs/pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,7 @@ order: 2
|
||||
|
||||
```yaml
|
||||
nonebot:
|
||||
# Nonebot机器人的配置,以前的最外层配置项仍可为Nonebot服务,但是部分内容会被覆盖,请尽快迁移
|
||||
# Nonebot机器人的配置,6.3.10版本后,NoneBot下配置已迁移至nonebot键下,不再使用外层配置,但是部分内容会被覆盖,请尽快迁移
|
||||
command_start: [ "/", "" ] # 指令前缀,若没有""空命令头,请开启alconna_use_command_start保证alconna解析正常
|
||||
host: 127.0.0.1 # 监听地址,默认为本机,若要接收外部请求请填写0.0.0.0
|
||||
port: 20216 # 绑定端口
|
||||
|
@ -1,48 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
基于socket的通道
|
||||
"""
|
||||
|
||||
|
||||
class SocksChannel:
|
||||
"""
|
||||
通道类,可以在进程间和进程内通信,双向但同时只能有一个发送者和一个接收者
|
||||
有两种接收工作方式,但是只能选择一种,主动接收和被动接收,主动接收使用 `receive` 方法,被动接收使用 `on_receive` 装饰器
|
||||
"""
|
||||
|
||||
def __init__(self, name: str):
|
||||
"""
|
||||
初始化通道
|
||||
Args:
|
||||
name: 通道ID
|
||||
"""
|
||||
|
||||
self._name = name
|
||||
self._conn_send = None
|
||||
self._conn_recv = None
|
||||
self._closed = False
|
||||
|
||||
def send(self, data):
|
||||
"""
|
||||
发送数据
|
||||
Args:
|
||||
data: 数据
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
def receive(self):
|
||||
"""
|
||||
接收数据
|
||||
Returns:
|
||||
data: 数据
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
def close(self):
|
||||
"""
|
||||
关闭通道
|
||||
"""
|
||||
|
||||
pass
|
@ -9,9 +9,9 @@ Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
|
||||
@Software: PyCharm
|
||||
"""
|
||||
|
||||
from liteyuki.message.on import on_startswith
|
||||
from liteyuki.message.event import MessageEvent
|
||||
from liteyuki.message.rule import is_su_rule
|
||||
from liteyuki.session.on import on_startswith
|
||||
from liteyuki.session.event import MessageEvent
|
||||
from liteyuki.session.rule import is_su_rule
|
||||
|
||||
|
||||
@on_startswith(["liteecho"], rule=is_su_rule).handle()
|
||||
|
@ -11,7 +11,6 @@ Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
|
||||
from typing import Any, Optional
|
||||
|
||||
from liteyuki import Channel
|
||||
from liteyuki.comm.storage import shared_memory
|
||||
|
||||
|
||||
class MessageEvent:
|
@ -11,8 +11,8 @@ Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
|
||||
import traceback
|
||||
from typing import Any, TypeAlias, Callable, Coroutine
|
||||
|
||||
from liteyuki.message.event import MessageEvent
|
||||
from liteyuki.message.rule import Rule
|
||||
from liteyuki.session.event import MessageEvent
|
||||
from liteyuki.session.rule import Rule
|
||||
|
||||
EventHandler: TypeAlias = Callable[[MessageEvent], Coroutine[None, None, Any]]
|
||||
|
@ -13,9 +13,9 @@ from queue import Queue
|
||||
|
||||
from liteyuki.comm.storage import shared_memory
|
||||
from liteyuki.log import logger
|
||||
from liteyuki.message.event import MessageEvent
|
||||
from liteyuki.message.matcher import Matcher
|
||||
from liteyuki.message.rule import Rule, empty_rule
|
||||
from liteyuki.session.event import MessageEvent
|
||||
from liteyuki.session.matcher import Matcher
|
||||
from liteyuki.session.rule import Rule, empty_rule
|
||||
|
||||
_matcher_list: list[Matcher] = []
|
||||
_queue: Queue = Queue()
|
@ -11,7 +11,7 @@ Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
|
||||
import inspect
|
||||
from typing import Optional, TypeAlias, Callable, Coroutine
|
||||
|
||||
from liteyuki.message.event import MessageEvent
|
||||
from liteyuki.session.event import MessageEvent
|
||||
from liteyuki import get_config
|
||||
|
||||
_superusers: list[str] = get_config("liteyuki.superusers", [])
|
6
pdm.lock
6
pdm.lock
@ -89,7 +89,7 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "croterline"
|
||||
version = "1.0.4"
|
||||
version = "1.0.5"
|
||||
requires_python = ">=3.10"
|
||||
summary = "Default template for PDM package"
|
||||
groups = ["default"]
|
||||
@ -97,8 +97,8 @@ dependencies = [
|
||||
"magicoca>=1.0.1",
|
||||
]
|
||||
files = [
|
||||
{file = "croterline-1.0.4-py3-none-any.whl", hash = "sha256:7af5f26c3cd66f965e7cd7cca2d5a839364ed65f281f9a7586aa20a62946f1d4"},
|
||||
{file = "croterline-1.0.4.tar.gz", hash = "sha256:98754b1033665580c88e3ef4621d9b4293265450d4ff0a7352bb19852c4e113b"},
|
||||
{file = "croterline-1.0.5-py3-none-any.whl", hash = "sha256:4c5ce5273dd7f47b5c96876452eb852dc6f3f7e4b17f9c4cadeb68665157857c"},
|
||||
{file = "croterline-1.0.5.tar.gz", hash = "sha256:288484e52682f9c8029a73e1023e930d8548245fc1397ae0fc36e17f09ce8f56"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -9,8 +9,8 @@ Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
|
||||
@Software: PyCharm
|
||||
"""
|
||||
from liteyuki.plugin import PluginMetadata, PluginType
|
||||
from liteyuki.message.on import on_message
|
||||
from liteyuki.message.event import MessageEvent
|
||||
from liteyuki.session.on import on_message
|
||||
from liteyuki.session.event import MessageEvent
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
name="你好轻雪",
|
||||
|
@ -4,7 +4,6 @@ from pathlib import Path
|
||||
import nonebot
|
||||
from croterline.utils import IsMainProcess
|
||||
|
||||
from liteyuki import get_bot
|
||||
from liteyuki.core import sub_process_manager
|
||||
from liteyuki.plugin import PluginMetadata, PluginType
|
||||
|
||||
@ -28,6 +27,7 @@ def nb_run(*args, **kwargs):
|
||||
if IsMainProcess:
|
||||
from .dev_reloader import *
|
||||
bot = get_bot()
|
||||
|
||||
sub_process_manager.add(
|
||||
name="nonebot", func=nb_run, **bot.config.get("nonebot", {})
|
||||
)
|
||||
|
@ -17,7 +17,7 @@ from nonebot.adapters.onebot.v11 import MessageEvent, Bot
|
||||
from liteyuki import Channel
|
||||
from liteyuki.comm import get_channel
|
||||
from liteyuki.comm.storage import shared_memory
|
||||
from liteyuki.message.event import MessageEvent as LiteyukiMessageEvent
|
||||
from liteyuki.session.event import MessageEvent as LiteyukiMessageEvent
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
name="轻雪push",
|
||||
|
@ -18,7 +18,6 @@ driver = get_driver()
|
||||
|
||||
@driver.on_startup
|
||||
async def load_plugins():
|
||||
print("load from", os.path.join(os.path.dirname(__file__), "../nonebot_plugins"))
|
||||
nonebot.plugin.load_plugins(os.path.abspath(os.path.join(os.path.dirname(__file__), "../nonebot_plugins")))
|
||||
# 从数据库读取已安装的插件
|
||||
if not get_config("safe_mode", False):
|
||||
|
Loading…
Reference in New Issue
Block a user