koishi-plugin-bilibili-notify 1.0.3 → 1.0.4-alpha.1

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/index.d.ts CHANGED
@@ -5,6 +5,7 @@ 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;
10
11
  font: string;
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')
@@ -76,14 +80,7 @@ function apply(ctx, config) {
76
80
  ctx.notifier.create({
77
81
  content: '请记得使用Auth插件创建超级管理员账号,没有权限将无法使用该插件提供的指令。'
78
82
  });
79
- // load database
80
- ctx.plugin(Database);
81
- // Regist server
82
- ctx.plugin(wbi_1.default, { key: config.key });
83
- ctx.plugin(generateImg_1.default, { cardColorStart: config.cardColorStart, cardColorEnd: config.cardColorEnd, font: config.font });
84
- ctx.plugin(biliAPI_1.default);
85
- // load plugin
86
- // ctx.plugin(Authority)
83
+ // load config
87
84
  // 转换为具体时间
88
85
  let dynamicLoopTime;
89
86
  switch (config.dynamicLoopTime) {
@@ -100,6 +97,24 @@ function apply(ctx, config) {
100
97
  dynamicLoopTime = 300;
101
98
  break;
102
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)
103
118
  ctx.plugin(comRegister_1.default, { pushTime: config.pushTime, dynamicCheckNumber: config.dynamicCheckNumber, dynamicLoopTime });
104
119
  // 当用户输入“恶魔兔,启动!”时,执行 help 指令
105
120
  ctx.middleware((session, next) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-bilibili-notify",
3
3
  "description": "Koishi bilibili notify plugin",
4
- "version": "1.0.3",
4
+ "version": "1.0.4-alpha.1",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
package/readme.md CHANGED
@@ -1,6 +1,4 @@
1
- <center>
2
1
  # Bilibili-Botify
3
- </center>
4
2
 
5
3
  基于 [koishi](../../../../koishijs/koishi) 框架的B站推送插件
6
4