2023-04-26 19:50:39 +08:00
2023-04-26 19:50:39 +08:00
🎉 init
2023-01-03 21:34:55 +08:00
2023-04-23 19:56:19 +08:00
2023-04-05 18:26:30 +08:00
🎉 init
2023-01-03 21:34:55 +08:00
2023-04-24 00:28:11 +08:00
2023-03-31 17:56:07 +08:00
2023-03-06 17:15:23 +08:00
2023-04-24 00:28:11 +08:00

⚙️GenshinUID Core 0.1.0

Code style: black Imports: isort Lint: flake8 pre-commit.ci status

KimigaiiWuyi/GenshinUID 的核心部分,平台无关,支持 HTTP/WS 形式调用,便于移植到其他平台以及框架。

目前仍在开发中。

安装Core

  1. git clone gsuid-core本体
git clone https://ghproxy.com/https://github.com/Genshin-bots/gsuid-core.git --depth=1 --single-branch
  1. 安装poetry
pip install poetry
  1. 安装所需依赖
poetry install
  1. 安装所需插件
# 安装v4 GenshinUID
cd plugins
git clone -b v4 https://ghproxy.com/https://github.com/KimigaiiWuyi/GenshinUID.git --depth=1 --single-branch
  1. 启动gsuid-core
# 在gsuid_core/genshin_core文件夹内
poetry run python core.py
  1. 链接其他适配端
  • 默认core将运行在localhost:8765端口上,如有需要可至config.json修改。
  • 在支持的Bot上例如NoneBot2、HoshinoBot安装相应适配插件启动Bot如果有修改端口则需要在启动Bot前修改适配插件相应端口即可自动连接Core端。

编写插件

import asyncio

from gsuid_core.sv import SL, SV
from gsuid_core.bot import Bot
from gsuid_core.models import Event


@SV('开关').on_prefix(('关闭', '开启')) # 定义一组服务`开关`,服务内有两个前缀触发器
async def get_switch_msg(bot: Bot, ev: Event):
    name = ev.text         # 获取消息除了命令之外的文字
    command = ev.command   # 获取消息中的命令部分
    im = await process(name)  # 自己的业务逻辑
    await bot.logger.info('正在进行[关闭/开启开关]')  # 发送loger
    await bot.send(im)   # 发送消息

sv=SV(
    name='复杂的服务',  # 定义一组服务`开关`,
    pm=2, # 权限 0为master1为superuser2为群的群主&管理员3为普通
    priority=5, # 整组服务的优先级
    enabled=True, # 是否启用
    black_list=[] # 黑名单
)

@sv.on_prefix('测试')
async def get_msg(bot: Bot, ev: Event):
    ...
Description
💖一套业务逻辑,多个平台支持!异步核心框架GsCore,为插件编写提供完善平台支持、核心数据库统一、复用游戏查询逻辑、网页控制台,支持Bot列表: NoneBot2 & HoshinoBot & ZeroBot & YunZaiBot & Koishi
Readme GPL-3.0 32 MiB
Languages
Python 97.8%
HTML 1.8%
Dockerfile 0.2%