-
Notifications
You must be signed in to change notification settings - Fork 0
/
sendNotify.js
2972 lines (2751 loc) · 121 KB
/
sendNotify.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* @Author: lxk0301 https://gitee.com/lxk0301
* @Date: 2020-08-19 16:12:40
* @Last Modified by: whyour
* @Last Modified time: 2021-5-1 15:00:54
* sendNotify 推送通知功能
* @param text 通知头
* @param desp 通知体
* @param params 某些推送通知方式点击弹窗可跳转, 例:{ url: 'https://abc.com' }
* @param author 作者仓库等信息 例:`本通知 By:https://github.com/whyour/qinglong`
*/
//详细说明参考 https://github.com/ccwav/QLScript2.
const querystring = require('querystring');
const exec = require('child_process').exec;
const $ = new Env();
const timeout = 15000; //超时时间(单位毫秒)
console.log("加载sendNotify,当前版本: 20220306");
// =======================================go-cqhttp通知设置区域===========================================
//gobot_url 填写请求地址http://127.0.0.1/send_private_msg
//gobot_token 填写在go-cqhttp文件设置的访问密钥
//gobot_qq 填写推送到个人QQ或者QQ群号
//go-cqhttp相关API https://docs.go-cqhttp.org/api
let GOBOT_URL = ''; // 推送到个人QQ: http://127.0.0.1/send_private_msg 群:http://127.0.0.1/send_group_msg
let GOBOT_TOKEN = ''; //访问密钥
let GOBOT_QQ = ''; // 如果GOBOT_URL设置 /send_private_msg 则需要填入 user_id=个人QQ 相反如果是 /send_group_msg 则需要填入 group_id=QQ群
// =======================================微信server酱通知设置区域===========================================
//此处填你申请的SCKEY.
//(环境变量名 PUSH_KEY)
let SCKEY = '';
// =======================================Bark App通知设置区域===========================================
//此处填你BarkAPP的信息(IP/设备码,例如:https://api.day.app/XXXXXXXX)
let BARK_PUSH = '';
//BARK app推送铃声,铃声列表去APP查看复制填写
let BARK_SOUND = '';
//BARK app推送消息的分组, 默认为"QingLong"
let BARK_GROUP = 'QingLong';
// =======================================telegram机器人通知设置区域===========================================
//此处填你telegram bot 的Token,telegram机器人通知推送必填项.例如:1077xxx4424:AAFjv0FcqxxxxxxgEMGfi22B4yh15R5uw
//(环境变量名 TG_BOT_TOKEN)
let TG_BOT_TOKEN = '';
//此处填你接收通知消息的telegram用户的id,telegram机器人通知推送必填项.例如:129xxx206
//(环境变量名 TG_USER_ID)
let TG_USER_ID = '';
//tg推送HTTP代理设置(不懂可忽略,telegram机器人通知推送功能中非必填)
let TG_PROXY_HOST = ''; //例如:127.0.0.1(环境变量名:TG_PROXY_HOST)
let TG_PROXY_PORT = ''; //例如:1080(环境变量名:TG_PROXY_PORT)
let TG_PROXY_AUTH = ''; //tg代理配置认证参数
//Telegram api自建的反向代理地址(不懂可忽略,telegram机器人通知推送功能中非必填),默认tg官方api(环境变量名:TG_API_HOST)
let TG_API_HOST = 'api.telegram.org';
// =======================================钉钉机器人通知设置区域===========================================
//此处填你钉钉 bot 的webhook,例如:5a544165465465645d0f31dca676e7bd07415asdasd
//(环境变量名 DD_BOT_TOKEN)
let DD_BOT_TOKEN = '';
//密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的字符串
let DD_BOT_SECRET = '';
// =======================================企业微信机器人通知设置区域===========================================
//此处填你企业微信机器人的 webhook(详见文档 https://work.weixin.qq.com/api/doc/90000/90136/91770),例如:693a91f6-7xxx-4bc4-97a0-0ec2sifa5aaa
//(环境变量名 QYWX_KEY)
let QYWX_KEY = '';
// =======================================企业微信应用消息通知设置区域===========================================
/*
此处填你企业微信应用消息的值(详见文档 https://work.weixin.qq.com/api/doc/90000/90135/90236)
环境变量名 QYWX_AM依次填入 corpid,corpsecret,touser(注:多个成员ID使用|隔开),agentid,消息类型(选填,不填默认文本消息类型)
注意用,号隔开(英文输入法的逗号),例如:wwcff56746d9adwers,B-791548lnzXBE6_BWfxdf3kSTMJr9vFEPKAbh6WERQ,mingcheng,1000001,2COXgjH2UIfERF2zxrtUOKgQ9XklUqMdGSWLBoW_lSDAdafat
可选推送消息类型(推荐使用图文消息(mpnews)):
- 文本卡片消息: 0 (数字零)
- 文本消息: 1 (数字一)
- 图文消息(mpnews): 素材库图片id, 可查看此教程(http://note.youdao.com/s/HMiudGkb)或者(https://note.youdao.com/ynoteshare1/index.html?id=1a0c8aff284ad28cbd011b29b3ad0191&type=note)
*/
let QYWX_AM = '';
// =======================================iGot聚合推送通知设置区域===========================================
//此处填您iGot的信息(推送key,例如:https://push.hellyw.com/XXXXXXXX)
let IGOT_PUSH_KEY = '';
// =======================================push+设置区域=======================================
//官方文档:http://www.pushplus.plus/
//PUSH_PLUS_TOKEN:微信扫码登录后一对一推送或一对多推送下面的token(您的Token),不提供PUSH_PLUS_USER则默认为一对一推送
//PUSH_PLUS_USER: 一对多推送的“群组编码”(一对多推送下面->您的群组(如无则新建)->群组编码,如果您是创建群组人。也需点击“查看二维码”扫描绑定,否则不能接受群组消息推送)
let PUSH_PLUS_TOKEN = '';
let PUSH_PLUS_USER = '';
let PUSH_PLUS_TOKEN_hxtrip = '';
let PUSH_PLUS_USER_hxtrip = '';
// ======================================= WxPusher 通知设置区域 ===========================================
// 此处填你申请的 appToken. 官方文档:https://wxpusher.zjiecode.com/docs
// WP_APP_TOKEN 可在管理台查看: https://wxpusher.zjiecode.com/admin/main/app/appToken
// WP_TOPICIDS 群发, 发送目标的 topicId, 以 ; 分隔! 使用 WP_UIDS 单发的时候, 可以不传
// WP_UIDS 发送目标的 uid, 以 ; 分隔。注意 WP_UIDS 和 WP_TOPICIDS 可以同时填写, 也可以只填写一个。
// WP_URL 原文链接, 可选参数
let WP_APP_TOKEN = "";
let WP_TOPICIDS = "";
let WP_UIDS = "";
let WP_URL = "";
let WP_APP_TOKEN_ONE = "";
if (process.env.WP_APP_TOKEN_ONE) {
WP_APP_TOKEN_ONE = process.env.WP_APP_TOKEN_ONE;
}
let WP_UIDS_ONE = "";
// =======================================gotify通知设置区域==============================================
//gotify_url 填写gotify地址,如https://push.example.de:8080
//gotify_token 填写gotify的消息应用token
//gotify_priority 填写推送消息优先级,默认为0
let GOTIFY_URL = '';
let GOTIFY_TOKEN = '';
let GOTIFY_PRIORITY = 0;
/**
* sendNotify 推送通知功能
* @param text 通知头
* @param desp 通知体
* @param params 某些推送通知方式点击弹窗可跳转, 例:{ url: 'https://abc.com' }
* @param author 作者仓库等信息 例:`本通知 By:https://github.com/whyour/qinglong`
* @returns {Promise<unknown>}
*/
let PushErrorTime = 0;
let strTitle = "";
let ShowRemarkType = "1";
let Notify_NoCKFalse = "false";
let Notify_NoLoginSuccess = "false";
let UseGroupNotify = 1;
const {
getEnvs,
DisableCk,
getEnvByPtPin
} = require('./ql');
const fs = require('fs');
let strCKFile = '/ql/scripts/CKName_cache.json';
let Fileexists = fs.existsSync(strCKFile);
let TempCK = [];
if (Fileexists) {
console.log("检测到别名缓存文件CKName_cache.json,载入...");
TempCK = fs.readFileSync(strCKFile, 'utf-8');
if (TempCK) {
TempCK = TempCK.toString();
TempCK = JSON.parse(TempCK);
}
}
let strUidFile = '/ql/scripts/CK_WxPusherUid.json';
let UidFileexists = fs.existsSync(strUidFile);
let TempCKUid = [];
if (UidFileexists) {
console.log("检测到一对一Uid文件WxPusherUid.json,载入...");
TempCKUid = fs.readFileSync(strUidFile, 'utf-8');
if (TempCKUid) {
TempCKUid = TempCKUid.toString();
TempCKUid = JSON.parse(TempCKUid);
}
}
let tempAddCK = {};
let boolneedUpdate = false;
let strCustom = "";
let strCustomArr = [];
let strCustomTempArr = [];
let Notify_CKTask = "";
let Notify_SkipText = [];
let isLogin = false;
if (process.env.NOTIFY_SHOWNAMETYPE) {
ShowRemarkType = process.env.NOTIFY_SHOWNAMETYPE;
if (ShowRemarkType == "2")
console.log("检测到显示备注名称,格式为: 京东别名(备注)");
if (ShowRemarkType == "3")
console.log("检测到显示备注名称,格式为: 京东账号(备注)");
if (ShowRemarkType == "4")
console.log("检测到显示备注名称,格式为: 备注");
}
async function sendNotify(text, desp, params = {}, author = '\n\n本通知 By ccwav Mod', strsummary = "") {
console.log(`开始发送通知...`);
//NOTIFY_FILTERBYFILE代码来自Ca11back.
if (process.env.NOTIFY_FILTERBYFILE) {
var no_notify = process.env.NOTIFY_FILTERBYFILE.split('&');
if (module.parent.filename) {
const script_name = module.parent.filename.split('/').slice(-1)[0];
if (no_notify.some(key_word => {
const flag = script_name.includes(key_word);
if (flag) {
console.log(`${script_name}含有关键字${key_word},不推送`);
}
return flag;
})) {
return;
}
}
}
try {
//Reset 变量
UseGroupNotify = 1;
strTitle = "";
GOBOT_URL = '';
GOBOT_TOKEN = '';
GOBOT_QQ = '';
SCKEY = '';
BARK_PUSH = '';
BARK_SOUND = '';
BARK_GROUP = 'QingLong';
TG_BOT_TOKEN = '';
TG_USER_ID = '';
TG_PROXY_HOST = '';
TG_PROXY_PORT = '';
TG_PROXY_AUTH = '';
TG_API_HOST = 'api.telegram.org';
DD_BOT_TOKEN = '';
DD_BOT_SECRET = '';
QYWX_KEY = '';
QYWX_AM = '';
IGOT_PUSH_KEY = '';
PUSH_PLUS_TOKEN = '';
PUSH_PLUS_USER = '';
PUSH_PLUS_TOKEN_hxtrip = '';
PUSH_PLUS_USER_hxtrip = '';
Notify_CKTask = "";
Notify_SkipText = [];
//变量开关
var Use_serverNotify = true;
var Use_pushPlusNotify = true;
var Use_BarkNotify = true;
var Use_tgBotNotify = true;
var Use_ddBotNotify = true;
var Use_qywxBotNotify = true;
var Use_qywxamNotify = true;
var Use_iGotNotify = true;
var Use_gobotNotify = true;
var Use_pushPlushxtripNotify = true;
var Use_WxPusher = true;
var strtext = text;
var strdesp = desp;
if (process.env.NOTIFY_NOCKFALSE) {
Notify_NoCKFalse = process.env.NOTIFY_NOCKFALSE;
}
if (process.env.NOTIFY_NOLOGINSUCCESS) {
Notify_NoLoginSuccess = process.env.NOTIFY_NOLOGINSUCCESS;
}
if (process.env.NOTIFY_CKTASK) {
Notify_CKTask = process.env.NOTIFY_CKTASK;
}
if (process.env.NOTIFY_SKIP_TEXT && desp) {
Notify_SkipText = process.env.NOTIFY_SKIP_TEXT.split('&');
if (Notify_SkipText.length > 0) {
for (var Templ in Notify_SkipText) {
if (desp.indexOf(Notify_SkipText[Templ]) != -1) {
console.log("检测内容到内容存在屏蔽推送的关键字(" + Notify_SkipText[Templ] + "),将跳过推送...");
return;
}
}
}
}
if (text.indexOf("cookie已失效") != -1 || desp.indexOf("重新登录获取") != -1 || text == "Ninja 运行通知") {
if (Notify_CKTask) {
console.log("触发CK脚本,开始执行....");
Notify_CKTask = "task " + Notify_CKTask + " now";
await exec(Notify_CKTask, function (error, stdout, stderr) {
console.log(error, stdout, stderr)
});
}
}
if (process.env.NOTIFY_AUTOCHECKCK == "true") {
if (text.indexOf("cookie已失效") != -1 || desp.indexOf("重新登录获取") != -1) {
console.log(`捕获CK过期通知,开始尝试处理...`);
var strPtPin = await GetPtPin(text);
var strdecPtPin = decodeURIComponent(strPtPin);
var llHaderror = false;
if (strPtPin) {
var temptest = await getEnvByPtPin(strdecPtPin);
if (temptest) {
if (temptest.status == 0) {
isLogin = true;
await isLoginByX1a0He(temptest.value);
if (!isLogin) {
var tempid = 0;
if (temptest._id) {
tempid = temptest._id;
}
if (temptest.id) {
tempid =temptest.id;
}
const DisableCkBody = await DisableCk(tempid);
strPtPin = temptest.value;
strPtPin = (strPtPin.match(/pt_pin=([^; ]+)(?=;?)/) && strPtPin.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
var strAllNotify = "";
var MessageUserGp2 = "";
var MessageUserGp3 = "";
var MessageUserGp4 = "";
var userIndex2 = -1;
var userIndex3 = -1;
var userIndex4 = -1;
var strNotifyOneTemp = "";
if ($.isNode() && process.env.BEANCHANGE_USERGP2) {
MessageUserGp2 = process.env.BEANCHANGE_USERGP2 ? process.env.BEANCHANGE_USERGP2.split('&') : [];
}
if ($.isNode() && process.env.BEANCHANGE_USERGP3) {
MessageUserGp3 = process.env.BEANCHANGE_USERGP3 ? process.env.BEANCHANGE_USERGP3.split('&') : [];
}
if ($.isNode() && process.env.BEANCHANGE_USERGP4) {
MessageUserGp4 = process.env.BEANCHANGE_USERGP4 ? process.env.BEANCHANGE_USERGP4.split('&') : [];
}
if (MessageUserGp4) {
userIndex4 = MessageUserGp4.findIndex((item) => item === strPtPin);
}
if (MessageUserGp2) {
userIndex2 = MessageUserGp2.findIndex((item) => item === strPtPin);
}
if (MessageUserGp3) {
userIndex3 = MessageUserGp3.findIndex((item) => item === strPtPin);
}
if (userIndex2 != -1) {
console.log(`该账号属于分组2`);
text = "京东CK检测#2";
}
if (userIndex3 != -1) {
console.log(`该账号属于分组3`);
text = "京东CK检测#3";
}
if (userIndex4 != -1) {
console.log(`该账号属于分组4`);
text = "京东CK检测#4";
}
if (userIndex4 == -1 && userIndex2 == -1 && userIndex3 == -1) {
text = "京东CK检测";
}
if (process.env.CHECKCK_ALLNOTIFY) {
strAllNotify = process.env.CHECKCK_ALLNOTIFY;
/* if (strTempNotify.length > 0) {
for (var TempNotifyl in strTempNotify) {
strAllNotify += strTempNotify[TempNotifyl] + '\n';
}
}*/
console.log(`检测到设定了温馨提示,将在推送信息中置顶显示...`);
strAllNotify = `\n【✨✨✨✨温馨提示✨✨✨✨】\n` + strAllNotify;
console.log(strAllNotify);
}
if (DisableCkBody.code == 200) {
console.log(`京东账号` + strdecPtPin + `已失效,自动禁用成功!\n`);
strNotifyOneTemp = `京东账号: ` + strdecPtPin + ` 已失效,自动禁用成功!\n如果要继续挂机,请联系管理员重新登录账号,账号有效期为30天.`;
strNotifyOneTemp += "\n任务标题:" + strtext;
if (strAllNotify)
strNotifyOneTemp += `\n` + strAllNotify;
desp = strNotifyOneTemp;
if (WP_APP_TOKEN_ONE) {
await sendNotifybyWxPucher(`账号过期下线通知`, strNotifyOneTemp, strdecPtPin);
}
} else {
console.log(`京东账号` + strPtPin + `已失效,自动禁用失败!\n`);
strNotifyOneTemp = `京东账号: ` + strdecPtPin + ` 已失效!\n如果要继续挂机,请联系管理员重新登录账号,账号有效期为30天.`;
strNotifyOneTemp += "\n任务标题:" + strtext;
if (strAllNotify)
strNotifyOneTemp += `\n` + strAllNotify;
desp = strNotifyOneTemp;
if (WP_APP_TOKEN_ONE) {
await sendNotifybyWxPucher(`账号过期下线通知`, strNotifyOneTemp, strdecPtPin);
}
}
} else {
console.log(`该CK已经检测没有有效,跳过通知...`);
llHaderror = true;
}
} else {
console.log(`该CK已经禁用不需要处理`);
llHaderror = true;
}
}
} else {
console.log(`CK过期通知处理失败...`);
}
if (llHaderror)
return;
}
}
if (strtext.indexOf("cookie已失效") != -1 || strdesp.indexOf("重新登录获取") != -1 || strtext == "Ninja 运行通知") {
if (Notify_NoCKFalse == "true" && text != "Ninja 运行通知") {
console.log(`检测到NOTIFY_NOCKFALSE变量为true,不发送ck失效通知...`);
return;
}
}
//检查黑名单屏蔽通知
const notifySkipList = process.env.NOTIFY_SKIP_LIST ? process.env.NOTIFY_SKIP_LIST.split('&') : [];
let titleIndex = notifySkipList.findIndex((item) => item === text);
if (titleIndex !== -1) {
console.log(`${text} 在推送黑名单中,已跳过推送`);
return;
}
if (text.indexOf("已可领取") != -1) {
if (text.indexOf("农场") != -1) {
strTitle = "东东农场领取";
} else {
strTitle = "东东萌宠领取";
}
}
if (text.indexOf("汪汪乐园养joy") != -1) {
strTitle = "汪汪乐园养joy领取";
}
if (text == "京喜工厂") {
if (desp.indexOf("元造进行兑换") != -1) {
strTitle = "京喜工厂领取";
}
}
if (text.indexOf("任务") != -1 && (text.indexOf("新增") != -1 || text.indexOf("删除") != -1)) {
strTitle = "脚本任务更新";
}
if (strTitle) {
const notifyRemindList = process.env.NOTIFY_NOREMIND ? process.env.NOTIFY_NOREMIND.split('&') : [];
titleIndex = notifyRemindList.findIndex((item) => item === strTitle);
if (titleIndex !== -1) {
console.log(`${text} 在领取信息黑名单中,已跳过推送`);
return;
}
} else {
strTitle = text;
}
if (Notify_NoLoginSuccess == "true") {
if (desp.indexOf("登陆成功") != -1) {
console.log(`登陆成功不推送`);
return;
}
}
if (strTitle == "汪汪乐园养joy领取" && WP_APP_TOKEN_ONE) {
console.log(`捕获汪汪乐园养joy领取通知,开始尝试一对一推送...`);
var strPtPin = await GetPtPin(text);
var strdecPtPin = decodeURIComponent(strPtPin);
if (strPtPin) {
await sendNotifybyWxPucher("汪汪乐园领取通知", `【京东账号】${strdecPtPin}\n当前等级: 30\n已自动领取最高等级奖励\n请前往京东极速版APP查看使用优惠券\n活动入口:京东极速版APP->我的->优惠券->京券`, strdecPtPin);
}
}
console.log("通知标题: " + strTitle);
//检查脚本名称是否需要通知到Group2,Group2读取原环境配置的变量名后加2的值.例如: QYWX_AM2
const notifyGroup2List = process.env.NOTIFY_GROUP2_LIST ? process.env.NOTIFY_GROUP2_LIST.split('&') : [];
const titleIndex2 = notifyGroup2List.findIndex((item) => item === strTitle);
const notifyGroup3List = process.env.NOTIFY_GROUP3_LIST ? process.env.NOTIFY_GROUP3_LIST.split('&') : [];
const titleIndexGp3 = notifyGroup3List.findIndex((item) => item === strTitle);
const notifyGroup4List = process.env.NOTIFY_GROUP4_LIST ? process.env.NOTIFY_GROUP4_LIST.split('&') : [];
const titleIndexGp4 = notifyGroup4List.findIndex((item) => item === strTitle);
const notifyGroup5List = process.env.NOTIFY_GROUP5_LIST ? process.env.NOTIFY_GROUP5_LIST.split('&') : [];
const titleIndexGp5 = notifyGroup5List.findIndex((item) => item === strTitle);
const notifyGroup6List = process.env.NOTIFY_GROUP6_LIST ? process.env.NOTIFY_GROUP6_LIST.split('&') : [];
const titleIndexGp6 = notifyGroup6List.findIndex((item) => item === strTitle);
const notifyGroup7List = process.env.NOTIFY_GROUP7_LIST ? process.env.NOTIFY_GROUP7_LIST.split('&') : [];
const titleIndexGp7 = notifyGroup7List.findIndex((item) => item === strTitle);
if (titleIndex2 !== -1) {
console.log(`${strTitle} 在群组2推送名单中,初始化群组推送`);
UseGroupNotify = 2;
}
if (titleIndexGp3 !== -1) {
console.log(`${strTitle} 在群组3推送名单中,初始化群组推送`);
UseGroupNotify = 3;
}
if (titleIndexGp4 !== -1) {
console.log(`${strTitle} 在群组4推送名单中,初始化群组推送`);
UseGroupNotify = 4;
}
if (titleIndexGp5 !== -1) {
console.log(`${strTitle} 在群组5推送名单中,初始化群组推送`);
UseGroupNotify = 5;
}
if (titleIndexGp6 !== -1) {
console.log(`${strTitle} 在群组6推送名单中,初始化群组推送`);
UseGroupNotify = 6;
}
if (titleIndexGp7 !== -1) {
console.log(`${strTitle} 在群组7推送名单中,初始化群组推送`);
UseGroupNotify = 7;
}
if (process.env.NOTIFY_CUSTOMNOTIFY) {
strCustom = process.env.NOTIFY_CUSTOMNOTIFY;
}
if (strCustom) {
strCustomArr = strCustom.replace(/^\[|\]$/g, "").split(",");
strCustomTempArr = [];
for (var Tempj in strCustomArr) {
strCustomTempArr = strCustomArr[Tempj].split("&");
if (strCustomTempArr.length > 1) {
if (strTitle == strCustomTempArr[0]) {
console.log("检测到自定义设定,开始执行配置...");
if (strCustomTempArr[1] == "组1") {
console.log("自定义设定强制使用组1配置通知...");
UseGroupNotify = 1;
}
if (strCustomTempArr[1] == "组2") {
console.log("自定义设定强制使用组2配置通知...");
UseGroupNotify = 2;
}
if (strCustomTempArr[1] == "组3") {
console.log("自定义设定强制使用组3配置通知...");
UseGroupNotify = 3;
}
if (strCustomTempArr[1] == "组4") {
console.log("自定义设定强制使用组4配置通知...");
UseGroupNotify = 4;
}
if (strCustomTempArr[1] == "组5") {
console.log("自定义设定强制使用组5配置通知...");
UseGroupNotify = 5;
}
if (strCustomTempArr[1] == "组6") {
console.log("自定义设定强制使用组6配置通知...");
UseGroupNotify = 6;
}
if (strCustomTempArr[1] == "组7") {
console.log("自定义设定强制使用组6配置通知...");
UseGroupNotify = 7;
}
if (strCustomTempArr.length > 2) {
console.log("关闭所有通知变量...");
Use_serverNotify = false;
Use_pushPlusNotify = false;
Use_pushPlushxtripNotify = false;
Use_BarkNotify = false;
Use_tgBotNotify = false;
Use_ddBotNotify = false;
Use_qywxBotNotify = false;
Use_qywxamNotify = false;
Use_iGotNotify = false;
Use_gobotNotify = false;
for (let Tempk = 2; Tempk < strCustomTempArr.length; Tempk++) {
var strTrmp = strCustomTempArr[Tempk];
switch (strTrmp) {
case "Server酱":
Use_serverNotify = true;
console.log("自定义设定启用Server酱进行通知...");
break;
case "pushplus":
Use_pushPlusNotify = true;
console.log("自定义设定启用pushplus(推送加)进行通知...");
break;
case "pushplushxtrip":
Use_pushPlushxtripNotify = true;
console.log("自定义设定启用pushplus_hxtrip(推送加)进行通知...");
break;
case "Bark":
Use_BarkNotify = true;
console.log("自定义设定启用Bark进行通知...");
break;
case "TG机器人":
Use_tgBotNotify = true;
console.log("自定义设定启用telegram机器人进行通知...");
break;
case "钉钉":
Use_ddBotNotify = true;
console.log("自定义设定启用钉钉机器人进行通知...");
break;
case "企业微信机器人":
Use_qywxBotNotify = true;
console.log("自定义设定启用企业微信机器人进行通知...");
break;
case "企业微信应用消息":
Use_qywxamNotify = true;
console.log("自定义设定启用企业微信应用消息进行通知...");
break;
case "iGotNotify":
Use_iGotNotify = true;
console.log("自定义设定启用iGot进行通知...");
break;
case "gobotNotify":
Use_gobotNotify = true;
console.log("自定义设定启用go-cqhttp进行通知...");
break;
case "WxPusher":
Use_WxPusher = true;
console.log("自定义设定启用WxPusher进行通知...");
break;
}
}
}
}
}
}
}
//console.log("UseGroup2 :"+UseGroup2);
//console.log("UseGroup3 :"+UseGroup3);
switch (UseGroupNotify) {
case 1:
if (process.env.GOBOT_URL && Use_gobotNotify) {
GOBOT_URL = process.env.GOBOT_URL;
}
if (process.env.GOBOT_TOKEN && Use_gobotNotify) {
GOBOT_TOKEN = process.env.GOBOT_TOKEN;
}
if (process.env.GOBOT_QQ && Use_gobotNotify) {
GOBOT_QQ = process.env.GOBOT_QQ;
}
if (process.env.PUSH_KEY && Use_serverNotify) {
SCKEY = process.env.PUSH_KEY;
}
if (process.env.WP_APP_TOKEN && Use_WxPusher) {
WP_APP_TOKEN = process.env.WP_APP_TOKEN;
}
if (process.env.WP_TOPICIDS && Use_WxPusher) {
WP_TOPICIDS = process.env.WP_TOPICIDS;
}
if (process.env.WP_UIDS && Use_WxPusher) {
WP_UIDS = process.env.WP_UIDS;
}
if (process.env.WP_URL && Use_WxPusher) {
WP_URL = process.env.WP_URL;
}
if (process.env.BARK_PUSH && Use_BarkNotify) {
if (process.env.BARK_PUSH.indexOf('https') > -1 || process.env.BARK_PUSH.indexOf('http') > -1) {
//兼容BARK自建用户
BARK_PUSH = process.env.BARK_PUSH;
} else {
BARK_PUSH = `https://api.day.app/${process.env.BARK_PUSH}`;
}
if (process.env.BARK_SOUND) {
BARK_SOUND = process.env.BARK_SOUND;
}
if (process.env.BARK_GROUP) {
BARK_GROUP = process.env.BARK_GROUP;
}
} else {
if (BARK_PUSH && BARK_PUSH.indexOf('https') === -1 && BARK_PUSH.indexOf('http') === -1 && Use_BarkNotify) {
//兼容BARK本地用户只填写设备码的情况
BARK_PUSH = `https://api.day.app/${BARK_PUSH}`;
}
}
if (process.env.TG_BOT_TOKEN && Use_tgBotNotify) {
TG_BOT_TOKEN = process.env.TG_BOT_TOKEN;
}
if (process.env.TG_USER_ID && Use_tgBotNotify) {
TG_USER_ID = process.env.TG_USER_ID;
}
if (process.env.TG_PROXY_AUTH && Use_tgBotNotify)
TG_PROXY_AUTH = process.env.TG_PROXY_AUTH;
if (process.env.TG_PROXY_HOST && Use_tgBotNotify)
TG_PROXY_HOST = process.env.TG_PROXY_HOST;
if (process.env.TG_PROXY_PORT && Use_tgBotNotify)
TG_PROXY_PORT = process.env.TG_PROXY_PORT;
if (process.env.TG_API_HOST && Use_tgBotNotify)
TG_API_HOST = process.env.TG_API_HOST;
if (process.env.DD_BOT_TOKEN && Use_ddBotNotify) {
DD_BOT_TOKEN = process.env.DD_BOT_TOKEN;
if (process.env.DD_BOT_SECRET) {
DD_BOT_SECRET = process.env.DD_BOT_SECRET;
}
}
if (process.env.QYWX_KEY && Use_qywxBotNotify) {
QYWX_KEY = process.env.QYWX_KEY;
}
if (process.env.QYWX_AM && Use_qywxamNotify) {
QYWX_AM = process.env.QYWX_AM;
}
if (process.env.IGOT_PUSH_KEY && Use_iGotNotify) {
IGOT_PUSH_KEY = process.env.IGOT_PUSH_KEY;
}
if (process.env.PUSH_PLUS_TOKEN && Use_pushPlusNotify) {
PUSH_PLUS_TOKEN = process.env.PUSH_PLUS_TOKEN;
}
if (process.env.PUSH_PLUS_USER && Use_pushPlusNotify) {
PUSH_PLUS_USER = process.env.PUSH_PLUS_USER;
}
if (process.env.PUSH_PLUS_TOKEN_hxtrip && Use_pushPlushxtripNotify) {
PUSH_PLUS_TOKEN_hxtrip = process.env.PUSH_PLUS_TOKEN_hxtrip;
}
if (process.env.PUSH_PLUS_USER_hxtrip && Use_pushPlushxtripNotify) {
PUSH_PLUS_USER_hxtrip = process.env.PUSH_PLUS_USER_hxtrip;
}
if (process.env.GOTIFY_URL) {
GOTIFY_URL = process.env.GOTIFY_URL;
}
if (process.env.GOTIFY_TOKEN) {
GOTIFY_TOKEN = process.env.GOTIFY_TOKEN;
}
if (process.env.GOTIFY_PRIORITY) {
GOTIFY_PRIORITY = process.env.GOTIFY_PRIORITY;
}
break;
case 2:
//==========================第二套环境变量赋值=========================
if (process.env.GOBOT_URL2 && Use_gobotNotify) {
GOBOT_URL = process.env.GOBOT_URL2;
}
if (process.env.GOBOT_TOKEN2 && Use_gobotNotify) {
GOBOT_TOKEN = process.env.GOBOT_TOKEN2;
}
if (process.env.GOBOT_QQ2 && Use_gobotNotify) {
GOBOT_QQ = process.env.GOBOT_QQ2;
}
if (process.env.PUSH_KEY2 && Use_serverNotify) {
SCKEY = process.env.PUSH_KEY2;
}
if (process.env.WP_APP_TOKEN2 && Use_WxPusher) {
WP_APP_TOKEN = process.env.WP_APP_TOKEN2;
}
if (process.env.WP_TOPICIDS2 && Use_WxPusher) {
WP_TOPICIDS = process.env.WP_TOPICIDS2;
}
if (process.env.WP_UIDS2 && Use_WxPusher) {
WP_UIDS = process.env.WP_UIDS2;
}
if (process.env.WP_URL2 && Use_WxPusher) {
WP_URL = process.env.WP_URL2;
}
if (process.env.BARK_PUSH2 && Use_BarkNotify) {
if (process.env.BARK_PUSH2.indexOf('https') > -1 || process.env.BARK_PUSH2.indexOf('http') > -1) {
//兼容BARK自建用户
BARK_PUSH = process.env.BARK_PUSH2;
} else {
BARK_PUSH = `https://api.day.app/${process.env.BARK_PUSH2}`;
}
if (process.env.BARK_SOUND2) {
BARK_SOUND = process.env.BARK_SOUND2;
}
if (process.env.BARK_GROUP2) {
BARK_GROUP = process.env.BARK_GROUP2;
}
}
if (process.env.TG_BOT_TOKEN2 && Use_tgBotNotify) {
TG_BOT_TOKEN = process.env.TG_BOT_TOKEN2;
}
if (process.env.TG_USER_ID2 && Use_tgBotNotify) {
TG_USER_ID = process.env.TG_USER_ID2;
}
if (process.env.TG_PROXY_AUTH2 && Use_tgBotNotify)
TG_PROXY_AUTH = process.env.TG_PROXY_AUTH2;
if (process.env.TG_PROXY_HOST2 && Use_tgBotNotify)
TG_PROXY_HOST = process.env.TG_PROXY_HOST2;
if (process.env.TG_PROXY_PORT2 && Use_tgBotNotify)
TG_PROXY_PORT = process.env.TG_PROXY_PORT2;
if (process.env.TG_API_HOST2 && Use_tgBotNotify)
TG_API_HOST = process.env.TG_API_HOST2;
if (process.env.DD_BOT_TOKEN2 && Use_ddBotNotify) {
DD_BOT_TOKEN = process.env.DD_BOT_TOKEN2;
if (process.env.DD_BOT_SECRET2) {
DD_BOT_SECRET = process.env.DD_BOT_SECRET2;
}
}
if (process.env.QYWX_KEY2 && Use_qywxBotNotify) {
QYWX_KEY = process.env.QYWX_KEY2;
}
if (process.env.QYWX_AM2 && Use_qywxamNotify) {
QYWX_AM = process.env.QYWX_AM2;
}
if (process.env.IGOT_PUSH_KEY2 && Use_iGotNotify) {
IGOT_PUSH_KEY = process.env.IGOT_PUSH_KEY2;
}
if (process.env.PUSH_PLUS_TOKEN2 && Use_pushPlusNotify) {
PUSH_PLUS_TOKEN = process.env.PUSH_PLUS_TOKEN2;
}
if (process.env.PUSH_PLUS_USER2 && Use_pushPlusNotify) {
PUSH_PLUS_USER = process.env.PUSH_PLUS_USER2;
}
if (process.env.PUSH_PLUS_TOKEN_hxtrip2 && Use_pushPlushxtripNotify) {
PUSH_PLUS_TOKEN_hxtrip = process.env.PUSH_PLUS_TOKEN_hxtrip2;
}
if (process.env.PUSH_PLUS_USER_hxtrip2 && Use_pushPlushxtripNotify) {
PUSH_PLUS_USER_hxtrip = process.env.PUSH_PLUS_USER_hxtrip2;
}
if (process.env.GOTIFY_URL2) {
GOTIFY_URL = process.env.GOTIFY_URL2;
}
if (process.env.GOTIFY_TOKEN2) {
GOTIFY_TOKEN = process.env.GOTIFY_TOKEN2;
}
if (process.env.GOTIFY_PRIORITY2) {
GOTIFY_PRIORITY = process.env.GOTIFY_PRIORITY2;
}
break;
case 3:
//==========================第三套环境变量赋值=========================
if (process.env.GOBOT_URL3 && Use_gobotNotify) {
GOBOT_URL = process.env.GOBOT_URL3;
}
if (process.env.GOBOT_TOKEN3 && Use_gobotNotify) {
GOBOT_TOKEN = process.env.GOBOT_TOKEN3;
}
if (process.env.GOBOT_QQ3 && Use_gobotNotify) {
GOBOT_QQ = process.env.GOBOT_QQ3;
}
if (process.env.PUSH_KEY3 && Use_serverNotify) {
SCKEY = process.env.PUSH_KEY3;
}
if (process.env.WP_APP_TOKEN3 && Use_WxPusher) {
WP_APP_TOKEN = process.env.WP_APP_TOKEN3;
}
if (process.env.WP_TOPICIDS3 && Use_WxPusher) {
WP_TOPICIDS = process.env.WP_TOPICIDS3;
}
if (process.env.WP_UIDS3 && Use_WxPusher) {
WP_UIDS = process.env.WP_UIDS3;
}
if (process.env.WP_URL3 && Use_WxPusher) {
WP_URL = process.env.WP_URL3;
}
if (process.env.BARK_PUSH3 && Use_BarkNotify) {
if (process.env.BARK_PUSH3.indexOf('https') > -1 || process.env.BARK_PUSH3.indexOf('http') > -1) {
//兼容BARK自建用户
BARK_PUSH = process.env.BARK_PUSH3;
} else {
BARK_PUSH = `https://api.day.app/${process.env.BARK_PUSH3}`;
}
if (process.env.BARK_SOUND3) {
BARK_SOUND = process.env.BARK_SOUND3;
}
if (process.env.BARK_GROUP3) {
BARK_GROUP = process.env.BARK_GROUP3;
}
}
if (process.env.TG_BOT_TOKEN3 && Use_tgBotNotify) {
TG_BOT_TOKEN = process.env.TG_BOT_TOKEN3;
}
if (process.env.TG_USER_ID3 && Use_tgBotNotify) {
TG_USER_ID = process.env.TG_USER_ID3;
}
if (process.env.TG_PROXY_AUTH3 && Use_tgBotNotify)
TG_PROXY_AUTH = process.env.TG_PROXY_AUTH3;
if (process.env.TG_PROXY_HOST3 && Use_tgBotNotify)
TG_PROXY_HOST = process.env.TG_PROXY_HOST3;
if (process.env.TG_PROXY_PORT3 && Use_tgBotNotify)
TG_PROXY_PORT = process.env.TG_PROXY_PORT3;
if (process.env.TG_API_HOST3 && Use_tgBotNotify)
TG_API_HOST = process.env.TG_API_HOST3;
if (process.env.DD_BOT_TOKEN3 && Use_ddBotNotify) {
DD_BOT_TOKEN = process.env.DD_BOT_TOKEN3;
if (process.env.DD_BOT_SECRET3) {
DD_BOT_SECRET = process.env.DD_BOT_SECRET3;
}
}
if (process.env.QYWX_KEY3 && Use_qywxBotNotify) {
QYWX_KEY = process.env.QYWX_KEY3;
}
if (process.env.QYWX_AM3 && Use_qywxamNotify) {
QYWX_AM = process.env.QYWX_AM3;
}
if (process.env.IGOT_PUSH_KEY3 && Use_iGotNotify) {
IGOT_PUSH_KEY = process.env.IGOT_PUSH_KEY3;
}
if (process.env.PUSH_PLUS_TOKEN3 && Use_pushPlusNotify) {
PUSH_PLUS_TOKEN = process.env.PUSH_PLUS_TOKEN3;
}
if (process.env.PUSH_PLUS_USER3 && Use_pushPlusNotify) {
PUSH_PLUS_USER = process.env.PUSH_PLUS_USER3;
}
if (process.env.PUSH_PLUS_TOKEN_hxtrip3 && Use_pushPlushxtripNotify) {
PUSH_PLUS_TOKEN_hxtrip = process.env.PUSH_PLUS_TOKEN_hxtrip3;
}
if (process.env.PUSH_PLUS_USER_hxtrip3 && Use_pushPlushxtripNotify) {
PUSH_PLUS_USER_hxtrip = process.env.PUSH_PLUS_USER_hxtrip3;
}
if (process.env.GOTIFY_URL3) {
GOTIFY_URL = process.env.GOTIFY_URL3;
}
if (process.env.GOTIFY_TOKEN3) {
GOTIFY_TOKEN = process.env.GOTIFY_TOKEN3;
}
if (process.env.GOTIFY_PRIORITY3) {
GOTIFY_PRIORITY = process.env.GOTIFY_PRIORITY3;
}
break;
case 4:
//==========================第四套环境变量赋值=========================
if (process.env.GOBOT_URL4 && Use_gobotNotify) {
GOBOT_URL = process.env.GOBOT_URL4;
}
if (process.env.GOBOT_TOKEN4 && Use_gobotNotify) {
GOBOT_TOKEN = process.env.GOBOT_TOKEN4;
}
if (process.env.GOBOT_QQ4 && Use_gobotNotify) {
GOBOT_QQ = process.env.GOBOT_QQ4;
}
if (process.env.PUSH_KEY4 && Use_serverNotify) {
SCKEY = process.env.PUSH_KEY4;
}
if (process.env.WP_APP_TOKEN4 && Use_WxPusher) {
WP_APP_TOKEN = process.env.WP_APP_TOKEN4;
}
if (process.env.WP_TOPICIDS4 && Use_WxPusher) {
WP_TOPICIDS = process.env.WP_TOPICIDS4;
}
if (process.env.WP_UIDS4 && Use_WxPusher) {
WP_UIDS = process.env.WP_UIDS4;
}
if (process.env.WP_URL4 && Use_WxPusher) {
WP_URL = process.env.WP_URL4;
}
if (process.env.BARK_PUSH4 && Use_BarkNotify) {
if (process.env.BARK_PUSH4.indexOf('https') > -1 || process.env.BARK_PUSH4.indexOf('http') > -1) {
//兼容BARK自建用户
BARK_PUSH = process.env.BARK_PUSH4;
} else {
BARK_PUSH = `https://api.day.app/${process.env.BARK_PUSH4}`;
}
if (process.env.BARK_SOUND4) {
BARK_SOUND = process.env.BARK_SOUND4;
}
if (process.env.BARK_GROUP4) {
BARK_GROUP = process.env.BARK_GROUP4;
}
}
if (process.env.TG_BOT_TOKEN4 && Use_tgBotNotify) {
TG_BOT_TOKEN = process.env.TG_BOT_TOKEN4;
}
if (process.env.TG_USER_ID4 && Use_tgBotNotify) {
TG_USER_ID = process.env.TG_USER_ID4;
}
if (process.env.TG_PROXY_AUTH4 && Use_tgBotNotify)
TG_PROXY_AUTH = process.env.TG_PROXY_AUTH4;
if (process.env.TG_PROXY_HOST4 && Use_tgBotNotify)
TG_PROXY_HOST = process.env.TG_PROXY_HOST4;
if (process.env.TG_PROXY_PORT4 && Use_tgBotNotify)
TG_PROXY_PORT = process.env.TG_PROXY_PORT4;
if (process.env.TG_API_HOST4 && Use_tgBotNotify)
TG_API_HOST = process.env.TG_API_HOST4;
if (process.env.DD_BOT_TOKEN4 && Use_ddBotNotify) {
DD_BOT_TOKEN = process.env.DD_BOT_TOKEN4;
if (process.env.DD_BOT_SECRET4) {
DD_BOT_SECRET = process.env.DD_BOT_SECRET4;
}
}