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/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 database
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-bilibili-notify",
3
3
  "description": "Koishi bilibili notify plugin",
4
- "version": "1.0.2",
4
+ "version": "1.0.4-alpha.0",
5
5
  "contributors": [
6
6
  "Akokko <admin@akokko.com>"
7
7
  ],
package/readme.md CHANGED
@@ -80,6 +80,7 @@
80
80
 
81
81
  ver 1.0.1 修复了一些bug,提供用户自己选择动态检测时间的选项
82
82
  ver 1.0.2 修复时间bug和字体乱码问题
83
+ ver 1.0.3 修复了一些bug,提供用户自己选择推送卡片字体样式的选项
83
84
 
84
85
  ## 感谢
85
86