Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
koishi-plugin-pics
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
3rdeye
koishi-plugin-pics
Commits
e3349f17
Commit
e3349f17
authored
May 03, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
readme
parent
156b8e2e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
40 deletions
+11
-40
CONTRIBUTING.md
CONTRIBUTING.md
+5
-34
README.md
README.md
+6
-6
No files found.
CONTRIBUTING.md
View file @
e3349f17
...
...
@@ -57,10 +57,10 @@ export class PicSource {
```
ts
import
{
Context
}
from
"
koishi
"
;
import
{
DefinePlugin
,
RegisterSchema
,
SchemaProperty
,
LifecycleEvents
}
from
"
koishi-thirdeye
"
;
import
{
PicSourcePlugin
,
PicsContainer
,
PicSourceConfig
}
from
"
koishi-plugin-pics
"
;
import
{
PicSourcePlugin
,
PicsContainer
}
from
"
koishi-plugin-pics
"
;
@
RegisterSchema
()
export
class
Config
extends
PicSourceConfig
{
export
class
Config
{
@
SchemaProperty
({
default
:
'
my-source
'
})
// 推荐覆盖该属性以提供默认值
name
:
string
;
...
...
@@ -91,7 +91,7 @@ ctx.plugin(MyPicSource, {
```
ts
import
{
Context
}
from
"
koishi
"
;
import
{
DefinePlugin
,
RegisterSchema
,
SchemaProperty
,
LifecycleEvents
}
from
"
koishi-thirdeye
"
;
import
{
PicSourcePlugin
,
PicsContainer
,
PicSourceConfig
}
from
"
koishi-plugin-pics
"
;
import
{
PicSourcePlugin
,
PicsContainer
}
from
"
koishi-plugin-pics
"
;
@
RegisterSchema
()
export
class
Config
{
...
...
@@ -130,38 +130,9 @@ ctx.plugin(MyMultiPicSource, {
});
```
### 开箱即用的 Schema 定义
为了方便编写图源插件的配置部分,这里提供了一些开箱即用的配置文件 Schema 定义,可以从
`koishi-plugin-pics`
中导出。
#### `PicSourceSchema`
包含下列字段的 Schema 定义,方便创建图源插件的配置。
```
ts
export
interface
PicSourceInfo
{
// 图源的标签列表,使用 -s 参数匹配。
tags
:
string
[];
// 图源权重,权重越大随机到的概率越大,默认 1
weight
:
number
;
// 图源名称。
name
:
string
;
// 图源介绍
description
:
string
;
// 是否为默认图源。用户未指定参数时使用默认图源。
isDefault
:
boolean
;
}
```
同时
`PicSourceInfo`
也可以从
`koishi-plugin-pics`
中导出。
#### `PicSourceConfig`
[
`schemastery-gen`
](
https://code.mycard.moe/3rdeye/schemastery-gen
)
或
[
`koishi-thirdeye`
](
https://code.mycard.moe/3rdeye/koishi-thirdeye
)
用户可以使用
`PicSourceConfig`
类。插件的配置文件直接继承该类即可。
> 继承 `PicSourceConfig` 的类需要手动使用 `@RegisterSchema()` 装饰器将自身注册为 Schema 定义。
### Schema 定义
> `schemastery-gen` 包请**不要**使用 Webpack 打包。使用 Webpack 编写插件的用户请把该包列为 external
。
图源配置会自动注入到图源插件的配置类中
。
```
ts
export
class
PicSourceConfig
{
...
...
README.md
View file @
e3349f17
...
...
@@ -27,20 +27,20 @@ npm install koishi-plugin-pics
### 图源插件
*
[
`koishi-plugin-picsource-localfs`
](
https://npmjs.com/package/koishi-plugin-picsource-localfs
)
本地文件图源。
*
[
koishi-plugin-picsource-localfs
](
https://npmjs.com/package/koishi-plugin-picsource-localfs
)
本地文件图源。
*
[
`koishi-plugin-picsource-lolicon`
](
https://npmjs.com/package/koishi-plugin-picsource-lolicon
)
[
Lolicon
]
(https://api.lolicon.app/ ) 图源。
*
[
koishi-plugin-picsource-lolicon
](
https://npmjs.com/package/koishi-plugin-picsource-lolicon
)
[
Lolicon
]
(https://api.lolicon.app/ ) 图源。
*
[
`koishi-plugin-picsource-heisi`
](
https://npmjs.com/package/koishi-plugin-picsource-heisi
)
heisi 图源,基于
[
nonebot_plugin_heisi
](
https://github.com/yzyyz1387/nonebot_plugin_heisi
)
。
*
[
koishi-plugin-picsource-heisi
](
https://npmjs.com/package/koishi-plugin-picsource-heisi
)
heisi 图源,基于
[
nonebot_plugin_heisi
](
https://github.com/yzyyz1387/nonebot_plugin_heisi
)
。
*
[
`koishi-plugin-picsource-yande`
](
https://npmjs.com/package/koishi-plugin-picsource-yande
)
[
Yandere
]
(https://yande.re/) 及
[
Konachan
](
https://konachan.com
)
图源。
*
[
koishi-plugin-picsource-yande
](
https://npmjs.com/package/koishi-plugin-picsource-yande
)
[
Yandere
]
(https://yande.re/) 及
[
Konachan
](
https://konachan.com
)
图源。
### 图源配置
在开始启动之前,你还需要添加一些配置,告诉 pics 插件有哪些图源插件可以使用,以及每个图源插件的配置。对于配置项的详细说明,请参考
[
配置
](
#配置
)
。
下面以
[
`koishi-plugin-picsource-lolicon`
](
https://npmjs.com/package/koishi-plugin-picsource-lolicon
)
和
[
`koishi-plugin-picsource-yande`
](
https://npmjs.com/package/koishi-plugin-picsource-yande
)
为例进行说明。
下面以
[
koishi-plugin-picsource-lolicon
](
https://npmjs.com/package/koishi-plugin-picsource-lolicon
)
和
[
koishi-plugin-picsource-yande
](
https://npmjs.com/package/koishi-plugin-picsource-yande
)
为例进行说明。
```
yaml
# koishi.yml
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment