🐛 一些小修小补

This commit is contained in:
Wuyi无疑 2023-02-16 00:02:35 +08:00
parent acf749c49f
commit ec3fe28cc5
4 changed files with 20 additions and 3 deletions

View File

@ -1 +1,6 @@
import sys
from pathlib import Path
from .version import __version__ as __version__ # noqa: F401
sys.path.append(str(Path(__file__).parents[1]))

View File

@ -35,3 +35,4 @@ async def websocket_endpoint(websocket: WebSocket, bot_id: str):
if __name__ == "__main__":
uvicorn.run(app, host=HOST, port=PORT)
uvicorn.run(app, host=HOST, port=PORT)

View File

@ -29,7 +29,13 @@ class Bot:
message = [MessageSegment.image(message)]
else:
message = [MessageSegment.text(message)]
send = MessageSend(content=message, bot_id=self.bot_id)
send = MessageSend(
content=message,
bot_id=self.bot_id,
target_type=self.user_type,
target_id=self.group_id if self.group_id else self.user_id,
)
print(f'[发送消息] {send}')
await self.bot.send_bytes(msgjson.encode(send))
async def _process(self):

View File

@ -1,5 +1,7 @@
from __future__ import annotations
from functools import wraps
from typing import Dict, List, Self, Tuple, Union, Literal, Callable, Optional
from typing import Dict, List, Tuple, Union, Literal, Callable, Optional
from trigger import Trigger
from config import core_config
@ -21,7 +23,7 @@ config_sv = core_config.get_config('sv')
class SV:
is_initialized = False
def __new__(cls: type[Self], *args):
def __new__(cls, *args):
# 判断sv是否已经被初始化
if args[0] in SL.lst:
return SL.lst[args[0]]
@ -113,3 +115,6 @@ class SV:
def on_keyword(self, keyword: Union[str, Tuple[str, ...]]) -> Callable:
return self._on('keyword', keyword)
return self._on('keyword', keyword)
return self._on('keyword', keyword)
return self._on('keyword', keyword)