Skip to content

Commit

Permalink
🍻 补充插件加载逻辑,适配GenshinUID
Browse files Browse the repository at this point in the history
  • Loading branch information
KimigaiiWuyi committed Feb 16, 2023
1 parent e4f83b9 commit e1856e0
Show file tree
Hide file tree
Showing 39 changed files with 162,392 additions and 43 deletions.
7 changes: 0 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,3 @@ repos:
rev: 1.3.0
hooks:
- id: poetry-check
# - id: poetry-export
# args: ["-f", "requirements.txt", "--without-hashes", "-o", "requirements.txt"]
# verbose: true
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.245'
hooks:
- id: ruff
5 changes: 0 additions & 5 deletions gsuid_core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
import sys
from pathlib import Path

from .version import __version__ as __version__ # noqa: F401

sys.path.append(str(Path(__file__).parents[1]))
3 changes: 1 addition & 2 deletions gsuid_core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

import websockets.client
from msgspec import json as msgjson
from models import Message, MessageSend, MessageReceive
from websockets.exceptions import ConnectionClosedError

from gsuid_core.models import Message, MessageSend, MessageReceive


class GsClient:
@classmethod
Expand Down
3 changes: 1 addition & 2 deletions gsuid_core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
from server import gss
from config import core_config
from handler import handle_event
from models import MessageReceive
from msgspec import json as msgjson
from fastapi import FastAPI, WebSocket, WebSocketDisconnect

from gsuid_core.models import MessageReceive

app = FastAPI()
HOST = core_config.get_config('HOST')
PORT = int(core_config.get_config('PORT'))
Expand Down
2 changes: 1 addition & 1 deletion gsuid_core/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from server import Bot
from trigger import Trigger
from config import core_config
from models import MessageContent, MessageReceive

from gsuid_core.sv import SL
from gsuid_core.models import MessageContent, MessageReceive

config_masters = core_config.get_config('masters')
config_superusers = core_config.get_config('superusers')
Expand Down
2 changes: 1 addition & 1 deletion gsuid_core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class MessageContent(Struct):
raw: Optional[MessageReceive] = None
raw_text: str = ''
command: Optional[str] = None
text: Optional[str] = None
text: str = ''
image: Optional[str] = None
at: Optional[str] = None
image_list: List[Any] = []
Expand Down
Empty file.
19 changes: 19 additions & 0 deletions gsuid_core/plugins/GenshinUID/genshinuid_achievement/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from gsuid_core.sv import SV
from gsuid_core.server import Bot
from gsuid_core.models import MessageContent

from .get_achi_desc import get_achi, get_daily_achi


@SV('成就委托查询').on_prefix('查委托')
async def send_task_info(bot: Bot, msg: MessageContent):
await bot.logger.info(f'[查委托] 参数:{msg.text}')
im = await get_daily_achi(msg.text)
await bot.send(im)


@SV('成就委托查询').on_prefix('查成就')
async def send_achi_info(bot: Bot, msg: MessageContent):
await bot.logger.info(f'[查成就] 参数:{msg.text}')
im = await get_achi(msg.text)
await bot.send(im)
Loading

0 comments on commit e1856e0

Please sign in to comment.