koishi-plugin-bilibili-notify 1.0.2 → 1.0.4-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/0.html +0 -0
- package/lib/biliAPI.d.ts +1 -1
- package/lib/biliAPI.js +18 -6
- package/lib/comRegister.d.ts +1 -1
- package/lib/comRegister.js +66 -62
- package/lib/generateImg.d.ts +21 -4
- package/lib/generateImg.js +576 -519
- package/lib/index.d.ts +2 -0
- package/lib/index.js +25 -8
- package/package.json +1 -1
- package/readme.md +1 -0
package/lib/index.d.ts
CHANGED
|
@@ -5,8 +5,10 @@ export interface Config {
|
|
|
5
5
|
pushTime: number;
|
|
6
6
|
dynamicCheckNumber: number;
|
|
7
7
|
dynamicLoopTime: '1分钟' | '2分钟' | '3分钟' | '5分钟';
|
|
8
|
+
renderType: 'render' | 'page';
|
|
8
9
|
cardColorStart: string;
|
|
9
10
|
cardColorEnd: string;
|
|
11
|
+
font: string;
|
|
10
12
|
key: string;
|
|
11
13
|
}
|
|
12
14
|
export declare const Config: Schema<Config>;
|
package/lib/index.js
CHANGED
|
@@ -56,6 +56,10 @@ exports.Config = koishi_1.Schema.object({
|
|
|
56
56
|
.role('')
|
|
57
57
|
.default('2分钟')
|
|
58
58
|
.description('设定多久检测一次动态。若需动态的时效性,可以设置为1分钟。若订阅的UP主经常在短时间内连着发多条动态应该将该值提高,否则会出现动态漏推送和晚推送的问题,默认值为2分钟'),
|
|
59
|
+
renderType: koishi_1.Schema.union(['render', 'page'])
|
|
60
|
+
.role('')
|
|
61
|
+
.default('render')
|
|
62
|
+
.description('渲染类型,默认为render模式,渲染速度更快,但会出现乱码问题,若出现乱码问题,请切换到page模式。若使用自定义字体,建议选择render模式'),
|
|
59
63
|
cardColorStart: koishi_1.Schema.string()
|
|
60
64
|
.pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
|
|
61
65
|
.default('#F38AB5')
|
|
@@ -64,6 +68,8 @@ exports.Config = koishi_1.Schema.object({
|
|
|
64
68
|
.pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
|
|
65
69
|
.default('#F9CCDF')
|
|
66
70
|
.description('推送卡片的结束渐变背景色,请填入16进制颜色代码,参考网站:https://colorate.azurewebsites.net/'),
|
|
71
|
+
font: koishi_1.Schema.string()
|
|
72
|
+
.description('推送卡片的字体样式,如果你想用你自己的字体可以在此填写,例如:Microsoft YaHei'),
|
|
67
73
|
key: koishi_1.Schema.string()
|
|
68
74
|
.pattern(/^[0-9a-f]{32}$/)
|
|
69
75
|
.role('secret')
|
|
@@ -74,14 +80,7 @@ function apply(ctx, config) {
|
|
|
74
80
|
ctx.notifier.create({
|
|
75
81
|
content: '请记得使用Auth插件创建超级管理员账号,没有权限将无法使用该插件提供的指令。'
|
|
76
82
|
});
|
|
77
|
-
// load
|
|
78
|
-
ctx.plugin(Database);
|
|
79
|
-
// Regist server
|
|
80
|
-
ctx.plugin(wbi_1.default, { key: config.key });
|
|
81
|
-
ctx.plugin(generateImg_1.default, { cardColorStart: config.cardColorStart, cardColorEnd: config.cardColorEnd });
|
|
82
|
-
ctx.plugin(biliAPI_1.default);
|
|
83
|
-
// load plugin
|
|
84
|
-
// ctx.plugin(Authority)
|
|
83
|
+
// load config
|
|
85
84
|
// 转换为具体时间
|
|
86
85
|
let dynamicLoopTime;
|
|
87
86
|
switch (config.dynamicLoopTime) {
|
|
@@ -98,6 +97,24 @@ function apply(ctx, config) {
|
|
|
98
97
|
dynamicLoopTime = 300;
|
|
99
98
|
break;
|
|
100
99
|
}
|
|
100
|
+
// 渲染模式
|
|
101
|
+
let renderType;
|
|
102
|
+
switch (config.renderType) {
|
|
103
|
+
case 'render':
|
|
104
|
+
renderType = 0;
|
|
105
|
+
break;
|
|
106
|
+
case 'page':
|
|
107
|
+
renderType = 1;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
// load database
|
|
111
|
+
ctx.plugin(Database);
|
|
112
|
+
// Regist server
|
|
113
|
+
ctx.plugin(wbi_1.default, { key: config.key });
|
|
114
|
+
ctx.plugin(generateImg_1.default, { renderType, cardColorStart: config.cardColorStart, cardColorEnd: config.cardColorEnd, font: config.font });
|
|
115
|
+
ctx.plugin(biliAPI_1.default);
|
|
116
|
+
// load plugin
|
|
117
|
+
// ctx.plugin(Authority)
|
|
101
118
|
ctx.plugin(comRegister_1.default, { pushTime: config.pushTime, dynamicCheckNumber: config.dynamicCheckNumber, dynamicLoopTime });
|
|
102
119
|
// 当用户输入“恶魔兔,启动!”时,执行 help 指令
|
|
103
120
|
ctx.middleware((session, next) => {
|
package/package.json
CHANGED