koishi-plugin-bilibili-notify 1.0.8 → 1.0.9-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/biliAPI.js +9 -1
- package/lib/comRegister.d.ts +1 -0
- package/lib/comRegister.js +33 -34
- package/lib/generateImg.d.ts +1 -0
- package/lib/generateImg.js +29 -20
- package/lib/index.d.ts +6 -1
- package/lib/index.js +25 -8
- package/package.json +1 -1
- package/readme.md +1 -0
package/lib/biliAPI.js
CHANGED
|
@@ -138,7 +138,15 @@ class BiliAPI extends koishi_1.Service {
|
|
|
138
138
|
disposeNotifier() { this.loginNotifier && this.loginNotifier.dispose(); }
|
|
139
139
|
createNewClient() {
|
|
140
140
|
this.jar = new tough_cookie_1.CookieJar();
|
|
141
|
-
this.client = (0, axios_cookiejar_support_1.wrapper)(axios_1.default.create({
|
|
141
|
+
this.client = (0, axios_cookiejar_support_1.wrapper)(axios_1.default.create({
|
|
142
|
+
jar: this.jar,
|
|
143
|
+
headers: {
|
|
144
|
+
'Content-Type': 'application/json; charset=utf-8',
|
|
145
|
+
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
|
146
|
+
'Origin': 'https://www.bilibili.com',
|
|
147
|
+
'Referer': 'https://www.bilibili.com/'
|
|
148
|
+
}
|
|
149
|
+
}));
|
|
142
150
|
}
|
|
143
151
|
getCookies() {
|
|
144
152
|
let cookies;
|
package/lib/comRegister.d.ts
CHANGED
package/lib/comRegister.js
CHANGED
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("@satorijs/element/jsx-runtime");
|
|
6
7
|
const koishi_1 = require("koishi");
|
|
7
8
|
// 导入qrcode
|
|
8
9
|
const qrcode_1 = __importDefault(require("qrcode"));
|
|
@@ -32,14 +33,15 @@ class ComRegister {
|
|
|
32
33
|
this.qqguildBot = ctx.bots[ctx.bots.findIndex(bot => bot.platform === 'qqguild')];
|
|
33
34
|
// 从数据库获取订阅
|
|
34
35
|
this.getSubFromDatabase(ctx);
|
|
35
|
-
/* ctx.command('test', { hidden: true, permissions: ['authority:5'] })
|
|
36
|
-
|
|
36
|
+
/* const testCom = ctx.command('test', { hidden: true, permissions: ['authority:5'] })
|
|
37
|
+
|
|
38
|
+
testCom.subcommand('.cookies')
|
|
37
39
|
.usage('测试指令,用于测试从数据库读取cookies')
|
|
38
40
|
.action(async () => {
|
|
39
41
|
await ctx.biliAPI.loadCookiesFromDatabase()
|
|
40
42
|
})
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
testCom
|
|
43
45
|
.subcommand('.my')
|
|
44
46
|
.usage('测试指令,用于测试获取自己信息')
|
|
45
47
|
.example('test.my')
|
|
@@ -48,7 +50,7 @@ class ComRegister {
|
|
|
48
50
|
console.log(content);
|
|
49
51
|
})
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
testCom
|
|
52
54
|
.subcommand('.user <mid:string>')
|
|
53
55
|
.usage('测试指令,用于测试获取用户信息')
|
|
54
56
|
.example('test.user 用户UID')
|
|
@@ -57,7 +59,7 @@ class ComRegister {
|
|
|
57
59
|
console.log(content);
|
|
58
60
|
})
|
|
59
61
|
|
|
60
|
-
|
|
62
|
+
testCom
|
|
61
63
|
.subcommand('.time')
|
|
62
64
|
.usage('测试时间接口')
|
|
63
65
|
.example('test.time')
|
|
@@ -65,7 +67,7 @@ class ComRegister {
|
|
|
65
67
|
session.send(await ctx.biliAPI.getTimeNow())
|
|
66
68
|
})
|
|
67
69
|
|
|
68
|
-
|
|
70
|
+
testCom
|
|
69
71
|
.subcommand('.exist')
|
|
70
72
|
.usage('测试写法')
|
|
71
73
|
.example('test.exist')
|
|
@@ -74,7 +76,7 @@ class ComRegister {
|
|
|
74
76
|
console.log(num && `Hello World`);
|
|
75
77
|
})
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
testCom
|
|
78
80
|
.subcommand('.gimg <uid:string> <index:number>')
|
|
79
81
|
.usage('测试图片生成')
|
|
80
82
|
.example('test.gimg')
|
|
@@ -89,7 +91,7 @@ class ComRegister {
|
|
|
89
91
|
await session.send(h.image(buffer, 'image/png'))
|
|
90
92
|
})
|
|
91
93
|
|
|
92
|
-
|
|
94
|
+
testCom
|
|
93
95
|
.subcommand('.group')
|
|
94
96
|
.usage('查看session groupId')
|
|
95
97
|
.example('test group')
|
|
@@ -97,7 +99,7 @@ class ComRegister {
|
|
|
97
99
|
console.log(session.event.channel);
|
|
98
100
|
})
|
|
99
101
|
|
|
100
|
-
|
|
102
|
+
testCom
|
|
101
103
|
.subcommand('.session')
|
|
102
104
|
.usage('查看seesion')
|
|
103
105
|
.example('test session')
|
|
@@ -105,15 +107,15 @@ class ComRegister {
|
|
|
105
107
|
console.log(session);
|
|
106
108
|
})
|
|
107
109
|
|
|
108
|
-
|
|
110
|
+
testCom
|
|
109
111
|
.subcommand('.utc')
|
|
110
112
|
.usage('获取当前UTC+8 Unix时间戳')
|
|
111
113
|
.example('test utc')
|
|
112
114
|
.action(async ({ session }) => {
|
|
113
115
|
session.send((await ctx.biliAPI.getServerUTCTime()).toString())
|
|
114
116
|
}) */
|
|
115
|
-
ctx.command('bili', 'bili-notify插件相关指令', { permissions: ['authority:3'] })
|
|
116
|
-
|
|
117
|
+
const biliCom = ctx.command('bili', 'bili-notify插件相关指令', { permissions: ['authority:3'] });
|
|
118
|
+
biliCom.subcommand('.login', '登录B站之后才可以进行之后的操作')
|
|
117
119
|
.usage('使用二维码登录,登录B站之后才可以进行之后的操作')
|
|
118
120
|
.example('bili login')
|
|
119
121
|
.action(async ({ session }) => {
|
|
@@ -188,7 +190,7 @@ class ComRegister {
|
|
|
188
190
|
}
|
|
189
191
|
}, 1000);
|
|
190
192
|
});
|
|
191
|
-
|
|
193
|
+
biliCom
|
|
192
194
|
.subcommand('.unsub <uid:string>', '取消订阅UP主动态、直播或全部')
|
|
193
195
|
.usage('取消订阅,加-l为取消直播订阅,加-d为取消动态订阅,什么都不加则为全部取消')
|
|
194
196
|
.option('live', '-l')
|
|
@@ -238,7 +240,7 @@ class ComRegister {
|
|
|
238
240
|
// 未订阅该用户,无需取消订阅
|
|
239
241
|
!exist && session.send('未订阅该用户,无需取消订阅');
|
|
240
242
|
});
|
|
241
|
-
|
|
243
|
+
biliCom
|
|
242
244
|
.subcommand('.show', '展示订阅对象')
|
|
243
245
|
.usage('展示订阅对象')
|
|
244
246
|
.example('bili show')
|
|
@@ -246,7 +248,7 @@ class ComRegister {
|
|
|
246
248
|
const subTable = this.subShow();
|
|
247
249
|
return subTable;
|
|
248
250
|
});
|
|
249
|
-
|
|
251
|
+
biliCom
|
|
250
252
|
.subcommand('.sub <mid:string> [guildId:string]', '订阅用户动态和直播通知')
|
|
251
253
|
.option('live', '-l')
|
|
252
254
|
.option('dynamic', '-d')
|
|
@@ -260,7 +262,7 @@ class ComRegister {
|
|
|
260
262
|
return '请使用指令bili login登录后再进行订阅操作';
|
|
261
263
|
}
|
|
262
264
|
// 如果订阅人数超过三个则直接返回
|
|
263
|
-
if (this.num >= 3)
|
|
265
|
+
if (!config.unlockSubLimits && this.num >= 3)
|
|
264
266
|
return '目前最多只能订阅三个人';
|
|
265
267
|
// 检查必选参数是否有值
|
|
266
268
|
if (!mid)
|
|
@@ -385,16 +387,9 @@ class ComRegister {
|
|
|
385
387
|
await bot.sendMessage(sub.targetId, `订阅${userData.info.uname}动态通知`);
|
|
386
388
|
}
|
|
387
389
|
// 新增订阅展示到控制台
|
|
388
|
-
|
|
389
|
-
const subTable = this.subShow();
|
|
390
|
-
// 判断之前是否存在Notifier
|
|
391
|
-
this.subNotifier && this.subNotifier.dispose();
|
|
392
|
-
this.subNotifier = ctx.notifier.create({
|
|
393
|
-
type: 'primary',
|
|
394
|
-
content: subTable
|
|
395
|
-
});
|
|
390
|
+
this.updateSubNotifier(ctx);
|
|
396
391
|
});
|
|
397
|
-
|
|
392
|
+
biliCom
|
|
398
393
|
.subcommand('.dynamic <uid:string> <guildId:string>', '订阅用户动态推送', { hidden: true })
|
|
399
394
|
.option('bot', '-b <type:string>')
|
|
400
395
|
.usage('订阅用户动态推送')
|
|
@@ -431,7 +426,7 @@ class ComRegister {
|
|
|
431
426
|
// 将销毁函数保存到订阅管理对象
|
|
432
427
|
this.subManager[index].dynamicDispose = dispose;
|
|
433
428
|
});
|
|
434
|
-
|
|
429
|
+
biliCom
|
|
435
430
|
.subcommand('.live <roomId:string> <guildId:string>', '订阅主播开播通知', { hidden: true })
|
|
436
431
|
.option('bot', '-b <type:string>')
|
|
437
432
|
.usage('订阅主播开播通知')
|
|
@@ -466,7 +461,7 @@ class ComRegister {
|
|
|
466
461
|
// 保存销毁函数
|
|
467
462
|
this.subManager[index].liveDispose = dispose;
|
|
468
463
|
});
|
|
469
|
-
|
|
464
|
+
biliCom
|
|
470
465
|
.subcommand('.status <roomId:string>', '查询主播当前直播状态', { hidden: true })
|
|
471
466
|
.usage('查询主播当前直播状态')
|
|
472
467
|
.example('bili status 732')
|
|
@@ -806,12 +801,15 @@ class ComRegister {
|
|
|
806
801
|
// 更新控制台提示
|
|
807
802
|
this.subNotifier && this.subNotifier.dispose();
|
|
808
803
|
// 获取subTable
|
|
809
|
-
|
|
804
|
+
let subTableArray = this.subShow().split('\n');
|
|
805
|
+
subTableArray.splice(subTableArray.length - 1, 1);
|
|
806
|
+
// 定义Table
|
|
807
|
+
let table = (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("ul", { children: subTableArray.map(str => ((0, jsx_runtime_1.jsx)("li", { children: str }))) }) });
|
|
808
|
+
/* subTableArray.forEach(str => {
|
|
809
|
+
table +=
|
|
810
|
+
}) */
|
|
810
811
|
// 设置更新后的提示
|
|
811
|
-
this.subNotifier = ctx.notifier.create(
|
|
812
|
-
type: 'primary',
|
|
813
|
-
content: subTable
|
|
814
|
-
});
|
|
812
|
+
this.subNotifier = ctx.notifier.create(table);
|
|
815
813
|
}
|
|
816
814
|
async getSubFromDatabase(ctx) {
|
|
817
815
|
// 如果未登录,则直接返回
|
|
@@ -826,10 +824,10 @@ class ComRegister {
|
|
|
826
824
|
this.num = subData.length;
|
|
827
825
|
// 如果订阅数量超过三个则被非法修改数据库
|
|
828
826
|
// 在控制台提示重新订阅
|
|
829
|
-
if (this.num > 3) {
|
|
827
|
+
if (!this.config.unlockSubLimits && this.num > 3) {
|
|
830
828
|
ctx.notifier.create({
|
|
831
829
|
type: 'danger',
|
|
832
|
-
content: '
|
|
830
|
+
content: '您未解锁订阅限制,且订阅数大于3人,请您手动删除bilibili表中多余的数据后,重启本插件'
|
|
833
831
|
});
|
|
834
832
|
return;
|
|
835
833
|
}
|
|
@@ -999,6 +997,7 @@ class ComRegister {
|
|
|
999
997
|
}
|
|
1000
998
|
(function (ComRegister) {
|
|
1001
999
|
ComRegister.Config = koishi_1.Schema.object({
|
|
1000
|
+
unlockSubLimits: koishi_1.Schema.boolean().required(),
|
|
1002
1001
|
pushTime: koishi_1.Schema.number().required(),
|
|
1003
1002
|
liveLoopTime: koishi_1.Schema.number().default(10),
|
|
1004
1003
|
dynamicLoopTime: koishi_1.Schema.number().default(60),
|
package/lib/generateImg.d.ts
CHANGED
package/lib/generateImg.js
CHANGED
|
@@ -91,9 +91,13 @@ class GenerateImg extends koishi_1.Service {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
.base-plate {
|
|
94
|
+
${this.config.removeBorder ? `
|
|
95
|
+
width: 740px;
|
|
96
|
+
` : `
|
|
94
97
|
width: 704px;
|
|
95
|
-
height: auto;
|
|
96
98
|
margin: 20px auto;
|
|
99
|
+
`}
|
|
100
|
+
height: auto;
|
|
97
101
|
border-radius: 10px;
|
|
98
102
|
background-color: #fff;
|
|
99
103
|
}
|
|
@@ -513,6 +517,7 @@ class GenerateImg extends koishi_1.Service {
|
|
|
513
517
|
* {
|
|
514
518
|
margin: 0;
|
|
515
519
|
padding: 0;
|
|
520
|
+
box-sizing: border-box;
|
|
516
521
|
font-family: "${this.config.font}", "Custom Font", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
517
522
|
}
|
|
518
523
|
|
|
@@ -539,9 +544,13 @@ class GenerateImg extends koishi_1.Service {
|
|
|
539
544
|
}
|
|
540
545
|
|
|
541
546
|
.base-plate {
|
|
547
|
+
${this.config.removeBorder ? `
|
|
548
|
+
width: 740px;
|
|
549
|
+
` : `
|
|
542
550
|
width: 704px;
|
|
543
|
-
height: auto;
|
|
544
551
|
margin: 20px auto;
|
|
552
|
+
`}
|
|
553
|
+
height: auto;
|
|
545
554
|
border-radius: 10px;
|
|
546
555
|
background-color: #fff;
|
|
547
556
|
}
|
|
@@ -552,10 +561,9 @@ class GenerateImg extends koishi_1.Service {
|
|
|
552
561
|
}
|
|
553
562
|
|
|
554
563
|
.card .anchor-avatar {
|
|
555
|
-
|
|
556
|
-
max-width: 50px;
|
|
564
|
+
max-width: 70px;
|
|
557
565
|
/* 设置最大宽度为容器宽度的100% */
|
|
558
|
-
max-height:
|
|
566
|
+
max-height: 70px;
|
|
559
567
|
/* 设置最大高度为容器高度的90% */
|
|
560
568
|
margin-right: 20px;
|
|
561
569
|
border-radius: 10px;
|
|
@@ -575,15 +583,15 @@ class GenerateImg extends koishi_1.Service {
|
|
|
575
583
|
display: flex;
|
|
576
584
|
flex-direction: column;
|
|
577
585
|
justify-content: space-between;
|
|
578
|
-
height:
|
|
586
|
+
height: 70px;
|
|
579
587
|
}
|
|
580
588
|
|
|
581
589
|
.card .up-info .up-name {
|
|
582
|
-
font-size:
|
|
590
|
+
font-size: 27px;
|
|
583
591
|
}
|
|
584
592
|
|
|
585
593
|
.card .pub-time {
|
|
586
|
-
font-size:
|
|
594
|
+
font-size: 20px;
|
|
587
595
|
color: grey;
|
|
588
596
|
}
|
|
589
597
|
|
|
@@ -593,12 +601,9 @@ class GenerateImg extends koishi_1.Service {
|
|
|
593
601
|
|
|
594
602
|
.card .dress-up {
|
|
595
603
|
position: relative;
|
|
596
|
-
max-width: 110px;
|
|
597
|
-
max-height: 34px;
|
|
598
604
|
/* background-image: url('${dynamicCardUrl}');
|
|
599
605
|
background-size: cover; */
|
|
600
|
-
font-size:
|
|
601
|
-
line-height: 33px;
|
|
606
|
+
font-size: 17px;
|
|
602
607
|
}
|
|
603
608
|
|
|
604
609
|
.card .dress-up img {
|
|
@@ -609,20 +614,23 @@ class GenerateImg extends koishi_1.Service {
|
|
|
609
614
|
.card .dress-up span {
|
|
610
615
|
position: absolute;
|
|
611
616
|
color: ${dynamicCardColor};
|
|
612
|
-
right:
|
|
613
|
-
top:
|
|
617
|
+
right: 67px;
|
|
618
|
+
top: 24px;
|
|
614
619
|
}
|
|
615
620
|
|
|
616
621
|
.card .card-topic {
|
|
617
622
|
display: flex;
|
|
618
623
|
align-items: center;
|
|
619
624
|
margin-top: 10px;
|
|
625
|
+
font-size: 20px;
|
|
620
626
|
color: #008AC5;
|
|
621
627
|
gap: 3px;
|
|
622
628
|
}
|
|
623
629
|
|
|
624
630
|
.card .card-details {
|
|
631
|
+
margin-top: 5px;
|
|
625
632
|
margin-bottom: 15px;
|
|
633
|
+
font-size: 22px;
|
|
626
634
|
width: 90%;
|
|
627
635
|
}
|
|
628
636
|
|
|
@@ -749,8 +757,8 @@ class GenerateImg extends koishi_1.Service {
|
|
|
749
757
|
}
|
|
750
758
|
|
|
751
759
|
.card .card-forward {
|
|
752
|
-
margin: 0 -15px 0 -
|
|
753
|
-
padding: 12px 15px 14px
|
|
760
|
+
margin: 0 -15px 0 -105px;
|
|
761
|
+
padding: 12px 15px 14px 105px;
|
|
754
762
|
background-color: #F6F7F8;
|
|
755
763
|
}
|
|
756
764
|
|
|
@@ -758,18 +766,18 @@ class GenerateImg extends koishi_1.Service {
|
|
|
758
766
|
display: flex;
|
|
759
767
|
align-items: center;
|
|
760
768
|
gap: 5px;
|
|
761
|
-
height:
|
|
769
|
+
height: 35px;
|
|
762
770
|
}
|
|
763
771
|
|
|
764
772
|
.forward-userinfo img {
|
|
765
|
-
width:
|
|
766
|
-
height:
|
|
773
|
+
width: 25px;
|
|
774
|
+
height: 25px;
|
|
767
775
|
border-radius: 50%;
|
|
768
776
|
}
|
|
769
777
|
|
|
770
778
|
.forward-userinfo span {
|
|
771
779
|
color: #61666D;
|
|
772
|
-
font-size:
|
|
780
|
+
font-size: 20px;
|
|
773
781
|
}
|
|
774
782
|
|
|
775
783
|
.card .card-reserve {
|
|
@@ -986,6 +994,7 @@ class GenerateImg extends koishi_1.Service {
|
|
|
986
994
|
(function (GenerateImg) {
|
|
987
995
|
GenerateImg.Config = koishi_1.Schema.object({
|
|
988
996
|
renderType: koishi_1.Schema.number(),
|
|
997
|
+
removeBorder: koishi_1.Schema.boolean(),
|
|
989
998
|
cardColorStart: koishi_1.Schema.string(),
|
|
990
999
|
cardColorEnd: koishi_1.Schema.string(),
|
|
991
1000
|
font: koishi_1.Schema.string()
|
package/lib/index.d.ts
CHANGED
|
@@ -2,14 +2,19 @@ import { Context, Schema } from 'koishi';
|
|
|
2
2
|
export declare const inject: string[];
|
|
3
3
|
export declare const name = "bilibili-notify";
|
|
4
4
|
export interface Config {
|
|
5
|
+
require: {};
|
|
6
|
+
key: string;
|
|
7
|
+
basicSettings: {};
|
|
8
|
+
unlockSubLimits: boolean;
|
|
5
9
|
pushTime: number;
|
|
6
10
|
dynamicCheckNumber: number;
|
|
7
11
|
dynamicLoopTime: '1分钟' | '2分钟' | '3分钟' | '5分钟';
|
|
8
12
|
renderType: 'render' | 'page';
|
|
13
|
+
style: {};
|
|
14
|
+
removeBorder: boolean;
|
|
9
15
|
cardColorStart: string;
|
|
10
16
|
cardColorEnd: string;
|
|
11
17
|
font: string;
|
|
12
|
-
key: string;
|
|
13
18
|
}
|
|
14
19
|
export declare const Config: Schema<Config>;
|
|
15
20
|
export declare function apply(ctx: Context, config: Config): void;
|
package/lib/index.js
CHANGED
|
@@ -39,6 +39,16 @@ const biliAPI_1 = __importDefault(require("./biliAPI"));
|
|
|
39
39
|
exports.inject = ['puppeteer', 'database', 'notifier'];
|
|
40
40
|
exports.name = 'bilibili-notify';
|
|
41
41
|
exports.Config = koishi_1.Schema.object({
|
|
42
|
+
require: koishi_1.Schema.object({}).description('必填设置'),
|
|
43
|
+
key: koishi_1.Schema.string()
|
|
44
|
+
.pattern(/^[0-9a-f]{32}$/)
|
|
45
|
+
.role('secret')
|
|
46
|
+
.required()
|
|
47
|
+
.description('请输入一个32位小写字母的十六进制密钥(例如:9b8db7ae562b9864efefe06289cc5530),使用此密钥将你的B站登录信息存储在数据库中,请一定保存好此密钥。如果你忘记了此密钥,必须重新登录。你可以自行生成,或到这个网站生成:https://www.sexauth.com/'),
|
|
48
|
+
basicSettings: koishi_1.Schema.object({}).description('基本设置'),
|
|
49
|
+
unlockSubLimits: koishi_1.Schema.boolean()
|
|
50
|
+
.default(false)
|
|
51
|
+
.description('解锁3个订阅限制,默认只允许订阅3位UP主。订阅过多用户可能有导致IP暂时被封禁的风险'),
|
|
42
52
|
pushTime: koishi_1.Schema.number()
|
|
43
53
|
.min(0)
|
|
44
54
|
.max(12)
|
|
@@ -60,6 +70,10 @@ exports.Config = koishi_1.Schema.object({
|
|
|
60
70
|
.role('')
|
|
61
71
|
.default('render')
|
|
62
72
|
.description('渲染类型,默认为render模式,渲染速度更快,但会出现乱码问题,若出现乱码问题,请切换到page模式。若使用自定义字体,建议选择render模式'),
|
|
73
|
+
style: koishi_1.Schema.object({}).description('美化设置'),
|
|
74
|
+
removeBorder: koishi_1.Schema.boolean()
|
|
75
|
+
.default(false)
|
|
76
|
+
.description('移除推送卡片边框'),
|
|
63
77
|
cardColorStart: koishi_1.Schema.string()
|
|
64
78
|
.pattern(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
|
|
65
79
|
.default('#F38AB5')
|
|
@@ -69,17 +83,20 @@ exports.Config = koishi_1.Schema.object({
|
|
|
69
83
|
.default('#F9CCDF')
|
|
70
84
|
.description('推送卡片的结束渐变背景色,请填入16进制颜色代码,参考网站:https://colorate.azurewebsites.net/'),
|
|
71
85
|
font: koishi_1.Schema.string()
|
|
72
|
-
.description('推送卡片的字体样式,如果你想用你自己的字体可以在此填写,例如:Microsoft YaHei')
|
|
73
|
-
key: koishi_1.Schema.string()
|
|
74
|
-
.pattern(/^[0-9a-f]{32}$/)
|
|
75
|
-
.role('secret')
|
|
76
|
-
.required()
|
|
77
|
-
.description('请输入一个32位小写字母的十六进制密钥(例如:9b8db7ae562b9864efefe06289cc5530),使用此密钥将你的B站登录信息存储在数据库中,请一定保存好此密钥。如果你忘记了此密钥,必须重新登录。你可以自行生成,或到这个网站生成:https://www.sexauth.com/')
|
|
86
|
+
.description('推送卡片的字体样式,如果你想用你自己的字体可以在此填写,例如:Microsoft YaHei')
|
|
78
87
|
});
|
|
79
88
|
function apply(ctx, config) {
|
|
89
|
+
// 设置提示
|
|
80
90
|
ctx.notifier.create({
|
|
81
91
|
content: '请记得使用Auth插件创建超级管理员账号,没有权限将无法使用该插件提供的指令。'
|
|
82
92
|
});
|
|
93
|
+
if (config.unlockSubLimits) { // 用户允许订阅超过三个用户
|
|
94
|
+
// 设置警告
|
|
95
|
+
ctx.notifier.create({
|
|
96
|
+
type: 'danger',
|
|
97
|
+
content: '过多的订阅可能会导致IP暂时被封禁!'
|
|
98
|
+
});
|
|
99
|
+
}
|
|
83
100
|
// load config
|
|
84
101
|
// 转换为具体时间
|
|
85
102
|
let dynamicLoopTime;
|
|
@@ -111,11 +128,11 @@ function apply(ctx, config) {
|
|
|
111
128
|
ctx.plugin(Database);
|
|
112
129
|
// Regist server
|
|
113
130
|
ctx.plugin(wbi_1.default, { key: config.key });
|
|
114
|
-
ctx.plugin(generateImg_1.default, { renderType, cardColorStart: config.cardColorStart, cardColorEnd: config.cardColorEnd, font: config.font });
|
|
131
|
+
ctx.plugin(generateImg_1.default, { renderType, removeBorder: config.removeBorder, cardColorStart: config.cardColorStart, cardColorEnd: config.cardColorEnd, font: config.font });
|
|
115
132
|
ctx.plugin(biliAPI_1.default);
|
|
116
133
|
// load plugin
|
|
117
134
|
// ctx.plugin(Authority)
|
|
118
|
-
ctx.plugin(comRegister_1.default, { pushTime: config.pushTime, dynamicCheckNumber: config.dynamicCheckNumber, dynamicLoopTime });
|
|
135
|
+
ctx.plugin(comRegister_1.default, { unlockSubLimits: config.unlockSubLimits, pushTime: config.pushTime, dynamicCheckNumber: config.dynamicCheckNumber, dynamicLoopTime });
|
|
119
136
|
// 当用户输入“恶魔兔,启动!”时,执行 help 指令
|
|
120
137
|
ctx.middleware((session, next) => {
|
|
121
138
|
if (session.content === '恶魔兔,启动!') {
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
- ver 1.0.6 修复了转发动态转发信息出现undefined的bug,修复了再次登录订阅显示错误的bug,优化了动态推送的逻辑
|
|
85
85
|
- ver 1.0.7 修复了在已登录情况下,再次登录会导致重复订阅和提示用户未订阅任何UP主的提示(实际上已订阅)的bug,新增了订阅对象在控制台的显示,优化了bili show指令的逻辑
|
|
86
86
|
- ver 1.0.8 修复了取消订阅的bug
|
|
87
|
+
- ver 1.0.9 更新请求客户端header信息。优化了动态推送卡片的页面布局,增加了字体大小。提供用户开放订阅数量限制的选项,提供用户移除推送卡片边框的选项。在控制台页面增加订阅信息提示
|
|
87
88
|
|
|
88
89
|
## 感谢
|
|
89
90
|
|