📝 新增资源站, 修正文档, 提供提示

This commit is contained in:
KimigaiiWuyi 2024-06-09 03:18:16 +08:00
parent e4c7bb8900
commit 16802e551e
5 changed files with 1170 additions and 666 deletions

View File

@ -7,8 +7,12 @@
[KimigaiiWuyi/GenshinUID](https://github.com/KimigaiiWuyi/GenshinUID) 的核心部分,平台无关,支持 HTTP/WS 形式调用,便于移植到其他平台以及框架。 [KimigaiiWuyi/GenshinUID](https://github.com/KimigaiiWuyi/GenshinUID) 的核心部分,平台无关,支持 HTTP/WS 形式调用,便于移植到其他平台以及框架。
本Readme的部分内容**可能已经失效**,请前往最新的详细文档查阅:
**🎉[详细文档](https://docs.sayu-bot.com)** **🎉[详细文档](https://docs.sayu-bot.com)**
👉[插件编写指南](https://docs.sayu-bot.com/CodePlugins/CookBook.html)
## 安装Core ## 安装Core
1. git clone gsuid-core本体 1. git clone gsuid-core本体
@ -83,73 +87,3 @@ docker-compose up -d
- 默认core将运行在`localhost:8765`端口上Docker部署必须修改`config.json`,如`0.0.0.0:8765` - 默认core将运行在`localhost:8765`端口上Docker部署必须修改`config.json`,如`0.0.0.0:8765`
- 如果Bot例如NoneBot2、HoshinoBot也是Docker部署的Core或其插件更新后可能需要将Core和Bot的容器都重启才生效 - 如果Bot例如NoneBot2、HoshinoBot也是Docker部署的Core或其插件更新后可能需要将Core和Bot的容器都重启才生效
## 配置文件
修改`gsuid_core/gsuid_core/config.json`,参考如下
**注意json不支持`#`,所以不要复制下面的配置到自己的文件中)**
```json
{
"HOST": "localhost", # 如需挂载公网修改为`0.0.0.0`
"PORT": "8765", # core端口
"masters": ["444835641", "111"], # Bot主人pm为0
"superusers": ["123456789"], # 超管pm为1
"sv": {
"Core管理": {
"priority": 5, # 某个服务的优先级
"enabled": true, # 某个服务是否启动
"pm": 1, # 某个服务要求的权限等级
"black_list": [], # 某个服务的黑名单
"area": "ALL", # 某个服务的触发范围
"white_list": [] # 某个服务的白名单
},
},
"log": {
"level": "DEBUG" # log等级
},
"command_start": ["/", "*"], # core内所有插件的要求前缀
"misfire_grace_time": 90
}
```
> 黑名单一旦设置黑名单中的用户ID将无法访问该服务
>
> 白名单一旦设置只有白名单的用户ID能访问该服务
>
> 服务配置可以通过[网页控制台](https://docs.gsuid.gbots.work/#/WebConsole)实时修改, 如果手动修改`config.json`需要**重启**
## 编写插件
```python
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, # 是否启用
area= 'ALL', # 群聊和私聊均可触发
black_list=[], # 黑名单
white_list=[], # 白名单
)
@sv.on_prefix('测试')
async def get_msg(bot: Bot, ev: Event):
...
```

View File

@ -485,6 +485,11 @@ async def to_markdown(
if isinstance(m.data, str): if isinstance(m.data, str):
if m.data.startswith('link://'): if m.data.startswith('link://'):
url = m.data.replace('link://', '') url = m.data.replace('link://', '')
if not size:
logger.warning(
'[to_markdown] 你传入了URL图片但并未规定图片大小'
'请在消息列表中额外传入MessageSegment.image_size()!'
)
elif m.data.startswith('base64://'): elif m.data.startswith('base64://'):
url = await _image_to_url(m.data, send_type, m) url = await _image_to_url(m.data, send_type, m)
@ -492,6 +497,7 @@ async def to_markdown(
_markdown_list.append( _markdown_list.append(
f'![图片 #{size[0]}px #{size[1]}px]({url})' f'![图片 #{size[0]}px #{size[1]}px]({url})'
) )
elif m.type == 'text': elif m.type == 'text':
assert isinstance(m.data, str) assert isinstance(m.data, str)
data = m.data.replace('\n', '\n\n') data = m.data.replace('\n', '\n\n')

View File

@ -66,8 +66,9 @@ async def check_speed():
global global_url global global_url
URL_LIB = { URL_LIB = {
'[JPFRP]': 'http://jp-2.lcf.icu:13643', '[JPFRP]': 'http://jp-3.lcf.1l1.icu:17217',
'[HKFRP]': 'http://hk-1.5gbps-2.lcf.icu:10200', '[HKFRP]': 'http://hk-1.lcf.1l1.icu:10200',
'[USFRP]': 'http://us-6.lcf.1l1.icu:28596',
'[XiaoWu]': 'http://frp.xiaowuap.com:63481', '[XiaoWu]': 'http://frp.xiaowuap.com:63481',
'[Chuncheon]': 'https://kr.qxqx.cf', '[Chuncheon]': 'https://kr.qxqx.cf',
'[Seoul]': 'https://kr-s.qxqx.cf', '[Seoul]': 'https://kr-s.qxqx.cf',

1660
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,74 +1,89 @@
--index-url https://mirrors.bfsu.edu.cn/pypi/web/simple --index-url https://mirrors.bfsu.edu.cn/pypi/web/simple
aioboto3==12.3.0 ; python_full_version >= "3.8.1" and python_version < "4.0" aioboto3==12.4.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
aiobotocore[boto3]==2.11.2 ; python_full_version >= "3.8.1" and python_version < "4.0" aiobotocore[boto3]==2.12.3 ; python_full_version >= "3.8.1" and python_version < "4.0"
aiofiles==23.2.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" aiofiles==23.2.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
aiohttp==3.9.3 ; python_full_version >= "3.8.1" and python_version < "4.0" aiohttp==3.9.5 ; python_full_version >= "3.8.1" and python_version < "4.0"
aioitertools==0.11.0 ; python_full_version >= "3.8.1" and python_version < "4.0" aioitertools==0.11.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
aiosignal==1.3.1 ; python_full_version >= "3.8.1" and python_version < "4.0" aiosignal==1.3.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
aiosqlite==0.19.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" aiosqlite==0.20.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
anyio==4.2.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" anyio==4.4.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
apscheduler==3.10.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" apscheduler==3.10.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
async-timeout==4.0.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" async-timeout==4.0.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
attrs==23.2.0 ; python_full_version >= "3.8.1" and python_version < "4.0" attrs==23.2.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
backports-zoneinfo==0.2.1 ; python_full_version >= "3.8.1" and python_version < "3.9" backports-zoneinfo==0.2.1 ; python_full_version >= "3.8.1" and python_version < "3.9"
bcrypt==4.0.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" bcrypt==4.0.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
beautifulsoup4==4.12.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" beautifulsoup4==4.12.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
boto3==1.34.34 ; python_full_version >= "3.8.1" and python_version < "4.0" boto3==1.34.69 ; python_full_version >= "3.8.1" and python_version < "4.0"
botocore==1.34.34 ; python_full_version >= "3.8.1" and python_version < "4.0" botocore==1.34.69 ; python_full_version >= "3.8.1" and python_version < "4.0"
casbin==1.35.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" casbin==1.36.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
certifi==2024.2.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" certifi==2024.6.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
click==8.1.7 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" click==8.1.7 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
colorama==0.4.6 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" colorama==0.4.6 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
dnspython==2.5.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" dnspython==2.6.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
email-validator==2.1.0.post1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" email-validator==2.1.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
exceptiongroup==1.2.0 ; python_full_version >= "3.8.1" and python_version < "3.11" exceptiongroup==1.2.1 ; python_full_version >= "3.8.1" and python_version < "3.11"
fastapi-amis-admin==0.7.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" fastapi-amis-admin==0.7.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
fastapi-user-auth==0.7.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" fastapi-cli==0.0.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
fastapi==0.109.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" fastapi-user-auth==0.7.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
fastapi==0.111.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
frozenlist==1.4.1 ; python_full_version >= "3.8.1" and python_version < "4.0" frozenlist==1.4.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
gitdb==4.0.11 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" gitdb==4.0.11 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
gitpython==3.1.41 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" gitpython==3.1.43 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
greenlet==3.0.3 ; python_full_version >= "3.8.1" and python_version < "4.0" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") greenlet==3.0.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32")
h11==0.14.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" h11==0.14.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
httpcore==1.0.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" httpcore==1.0.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
httpx==0.26.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" httptools==0.6.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
idna==3.6 ; python_full_version >= "3.8.1" and python_version < "4.0" httpx==0.27.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
jinja2==3.1.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" idna==3.7 ; python_full_version >= "3.8.1" and python_version < "4.0"
jinja2==3.1.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
jmespath==1.0.1 ; python_full_version >= "3.8.1" and python_version < "4.0" jmespath==1.0.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
loguru==0.6.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" loguru==0.6.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
lxml==5.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" lxml==5.2.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
markdown-it-py==3.0.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
markupsafe==2.1.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" markupsafe==2.1.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
motor==3.3.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" mdurl==0.1.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
motor==3.4.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
mpmath==1.3.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" mpmath==1.3.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
msgspec==0.18.6 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" msgspec==0.18.6 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
multidict==6.0.5 ; python_full_version >= "3.8.1" and python_version < "4.0" multidict==6.0.5 ; python_full_version >= "3.8.1" and python_version < "4.0"
orjson==3.10.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
passlib==1.7.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" passlib==1.7.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
pillow==10.2.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" pillow==10.3.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
pydantic==1.10.14 ; python_full_version >= "3.8.1" and python_version < "4.0" pydantic==1.10.15 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
pymongo==4.6.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" pygments==2.18.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
pymongo==4.7.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
pypng==0.20220715.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" pypng==0.20220715.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
python-dateutil==2.8.2 ; python_full_version >= "3.8.1" and python_version < "4.0" python-dateutil==2.9.0.post0 ; python_full_version >= "3.8.1" and python_version < "4.0"
python-multipart==0.0.7 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" python-dotenv==1.0.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
python-multipart==0.0.9 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
pytz==2024.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" pytz==2024.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
pyyaml==6.0.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
qrcode[pil]==7.4.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" qrcode[pil]==7.4.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
s3transfer==0.10.0 ; python_full_version >= "3.8.1" and python_version < "4.0" rich==13.7.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
setuptools==69.0.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" s3transfer==0.10.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
setuptools==70.0.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
shellingham==1.5.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
simpleeval==0.9.13 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" simpleeval==0.9.13 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
six==1.16.0 ; python_full_version >= "3.8.1" and python_version < "4.0" six==1.16.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
smmap==5.0.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" smmap==5.0.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sniffio==1.3.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" sniffio==1.3.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
soupsieve==2.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" soupsieve==2.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sqlalchemy-database==0.1.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" sqlalchemy-database==0.1.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sqlalchemy==2.0.25 ; python_full_version >= "3.8.1" and python_version < "4.0" sqlalchemy==2.0.30 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
sqlmodel==0.0.14 ; python_full_version >= "3.8.1" and python_version < "4.0" sqlmodel==0.0.19 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
starlette==0.36.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" starlette==0.37.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
toml==0.10.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" toml==0.10.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
typing-extensions==4.9.0 ; python_full_version >= "3.8.1" and python_version < "4.0" typer==0.12.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
tzdata==2023.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" and platform_system == "Windows" typing-extensions==4.12.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
tzdata==2024.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" and platform_system == "Windows"
tzlocal==5.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" tzlocal==5.2 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
ujson==5.10.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
urllib3==1.26.18 ; python_full_version >= "3.8.1" and python_version < "4.0" urllib3==1.26.18 ; python_full_version >= "3.8.1" and python_version < "4.0"
uvicorn==0.27.0.post1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" uvicorn==0.30.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
uvicorn[standard]==0.30.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
uvloop==0.19.0 ; (sys_platform != "win32" and sys_platform != "cygwin") and platform_python_implementation != "PyPy" and python_full_version >= "3.8.1" and python_full_version < "4.0.0"
watchfiles==0.22.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
websockets==10.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" websockets==10.4 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"
win32-setctime==1.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" and sys_platform == "win32" win32-setctime==1.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" and sys_platform == "win32"
wrapt==1.16.0 ; python_full_version >= "3.8.1" and python_version < "4.0" wrapt==1.16.0 ; python_full_version >= "3.8.1" and python_version < "4.0"