koishi-plugin-bilibili-notify 3.3.11 → 3.3.12-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.
Files changed (3) hide show
  1. package/lib/index.js +23 -19
  2. package/lib/index.mjs +23 -19
  3. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1245,25 +1245,29 @@ var ComRegister = class {
1245
1245
  this.logger.info("正在获取前90热词");
1246
1246
  const words = Object.entries(danmakuWeightRecord);
1247
1247
  const danmaker = Object.entries(danmakuMakerRecord);
1248
- if (words.length < 50) {
1249
- this.logger.info("热词不足50个,本次弹幕词云放弃");
1250
- return;
1251
- }
1252
- if (danmaker.length < 5) {
1253
- this.logger.info("发言人数不足5位,本次弹幕词云放弃");
1254
- return;
1255
- }
1256
- const top90Words = words.sort((a, b) => b[1] - a[1]).slice(0, 90);
1257
- this.logger.info("弹幕词云前90词及权重:");
1258
- this.logger.info(top90Words);
1259
- this.logger.info("正在准备生成弹幕词云");
1260
- const buffer = await this.ctx["bilibili-notify-generate-img"].generateWordCloudImg(top90Words, masterInfo.username);
1261
- const img = koishi.h.image(buffer, "image/jpeg");
1262
- this.logger.info("开始构建弹幕发送排行榜消息");
1263
- const danmakuMakerCount = Object.keys(danmakuMakerRecord).length;
1264
- const danmakuCount = Object.values(danmakuMakerRecord).reduce((sum, val) => sum + val, 0);
1265
- const top5DanmakuMaker = Object.entries(danmakuMakerRecord).sort((a, b) => b[1] - a[1]).slice(0, 5);
1266
- const summary = customLiveSummary.replace("-dmc", `${danmakuMakerCount}`).replace("-mdn", `${masterInfo.medalName}`).replace("-dca", `${danmakuCount}`).replace("-un1", `${top5DanmakuMaker[0][0]}`).replace("-dc1", `${top5DanmakuMaker[0][1]}`).replace("-un2", `${top5DanmakuMaker[1][0]}`).replace("-dc2", `${top5DanmakuMaker[1][1]}`).replace("-un3", `${top5DanmakuMaker[2][0]}`).replace("-dc3", `${top5DanmakuMaker[2][1]}`).replace("-un4", `${top5DanmakuMaker[3][0]}`).replace("-dc4", `${top5DanmakuMaker[3][1]}`).replace("-un5", `${top5DanmakuMaker[4][0]}`).replace("-dc5", `${top5DanmakuMaker[4][1]}`).replaceAll("\\n", "\n");
1248
+ const img = await (async () => {
1249
+ if (words.length < 50) {
1250
+ this.logger.info("热词不足50个,本次弹幕词云放弃");
1251
+ return;
1252
+ }
1253
+ const top90Words = words.sort((a, b) => b[1] - a[1]).slice(0, 90);
1254
+ this.logger.info("弹幕词云前90词及权重:");
1255
+ this.logger.info(top90Words);
1256
+ this.logger.info("正在准备生成弹幕词云");
1257
+ const buffer = await this.ctx["bilibili-notify-generate-img"].generateWordCloudImg(top90Words, masterInfo.username);
1258
+ return koishi.h.image(buffer, "image/jpeg");
1259
+ })();
1260
+ const summary = (() => {
1261
+ if (danmaker.length < 5) {
1262
+ this.logger.info("发言人数不足5位,本次弹幕词云放弃");
1263
+ return;
1264
+ }
1265
+ this.logger.info("开始构建弹幕发送排行榜消息");
1266
+ const danmakuMakerCount = Object.keys(danmakuMakerRecord).length;
1267
+ const danmakuCount = Object.values(danmakuMakerRecord).reduce((sum, val) => sum + val, 0);
1268
+ const top5DanmakuMaker = Object.entries(danmakuMakerRecord).sort((a, b) => b[1] - a[1]).slice(0, 5);
1269
+ return customLiveSummary.replace("-dmc", `${danmakuMakerCount}`).replace("-mdn", `${masterInfo.medalName}`).replace("-dca", `${danmakuCount}`).replace("-un1", `${top5DanmakuMaker[0][0]}`).replace("-dc1", `${top5DanmakuMaker[0][1]}`).replace("-un2", `${top5DanmakuMaker[1][0]}`).replace("-dc2", `${top5DanmakuMaker[1][1]}`).replace("-un3", `${top5DanmakuMaker[2][0]}`).replace("-dc3", `${top5DanmakuMaker[2][1]}`).replace("-un4", `${top5DanmakuMaker[3][0]}`).replace("-dc4", `${top5DanmakuMaker[3][1]}`).replace("-un5", `${top5DanmakuMaker[4][0]}`).replace("-dc5", `${top5DanmakuMaker[4][1]}`).replaceAll("\\n", "\n");
1270
+ })();
1267
1271
  await this.broadcastToTargets(sub.uid, [img, summary], PushType.WordCloudAndLiveSummary);
1268
1272
  Object.keys(danmakuWeightRecord).forEach((key) => delete danmakuWeightRecord[key]);
1269
1273
  Object.keys(danmakuMakerRecord).forEach((key) => delete danmakuMakerRecord[key]);
package/lib/index.mjs CHANGED
@@ -1227,25 +1227,29 @@ var ComRegister = class {
1227
1227
  this.logger.info("正在获取前90热词");
1228
1228
  const words = Object.entries(danmakuWeightRecord);
1229
1229
  const danmaker = Object.entries(danmakuMakerRecord);
1230
- if (words.length < 50) {
1231
- this.logger.info("热词不足50个,本次弹幕词云放弃");
1232
- return;
1233
- }
1234
- if (danmaker.length < 5) {
1235
- this.logger.info("发言人数不足5位,本次弹幕词云放弃");
1236
- return;
1237
- }
1238
- const top90Words = words.sort((a, b) => b[1] - a[1]).slice(0, 90);
1239
- this.logger.info("弹幕词云前90词及权重:");
1240
- this.logger.info(top90Words);
1241
- this.logger.info("正在准备生成弹幕词云");
1242
- const buffer = await this.ctx["bilibili-notify-generate-img"].generateWordCloudImg(top90Words, masterInfo.username);
1243
- const img = h.image(buffer, "image/jpeg");
1244
- this.logger.info("开始构建弹幕发送排行榜消息");
1245
- const danmakuMakerCount = Object.keys(danmakuMakerRecord).length;
1246
- const danmakuCount = Object.values(danmakuMakerRecord).reduce((sum, val) => sum + val, 0);
1247
- const top5DanmakuMaker = Object.entries(danmakuMakerRecord).sort((a, b) => b[1] - a[1]).slice(0, 5);
1248
- const summary = customLiveSummary.replace("-dmc", `${danmakuMakerCount}`).replace("-mdn", `${masterInfo.medalName}`).replace("-dca", `${danmakuCount}`).replace("-un1", `${top5DanmakuMaker[0][0]}`).replace("-dc1", `${top5DanmakuMaker[0][1]}`).replace("-un2", `${top5DanmakuMaker[1][0]}`).replace("-dc2", `${top5DanmakuMaker[1][1]}`).replace("-un3", `${top5DanmakuMaker[2][0]}`).replace("-dc3", `${top5DanmakuMaker[2][1]}`).replace("-un4", `${top5DanmakuMaker[3][0]}`).replace("-dc4", `${top5DanmakuMaker[3][1]}`).replace("-un5", `${top5DanmakuMaker[4][0]}`).replace("-dc5", `${top5DanmakuMaker[4][1]}`).replaceAll("\\n", "\n");
1230
+ const img = await (async () => {
1231
+ if (words.length < 50) {
1232
+ this.logger.info("热词不足50个,本次弹幕词云放弃");
1233
+ return;
1234
+ }
1235
+ const top90Words = words.sort((a, b) => b[1] - a[1]).slice(0, 90);
1236
+ this.logger.info("弹幕词云前90词及权重:");
1237
+ this.logger.info(top90Words);
1238
+ this.logger.info("正在准备生成弹幕词云");
1239
+ const buffer = await this.ctx["bilibili-notify-generate-img"].generateWordCloudImg(top90Words, masterInfo.username);
1240
+ return h.image(buffer, "image/jpeg");
1241
+ })();
1242
+ const summary = (() => {
1243
+ if (danmaker.length < 5) {
1244
+ this.logger.info("发言人数不足5位,本次弹幕词云放弃");
1245
+ return;
1246
+ }
1247
+ this.logger.info("开始构建弹幕发送排行榜消息");
1248
+ const danmakuMakerCount = Object.keys(danmakuMakerRecord).length;
1249
+ const danmakuCount = Object.values(danmakuMakerRecord).reduce((sum, val) => sum + val, 0);
1250
+ const top5DanmakuMaker = Object.entries(danmakuMakerRecord).sort((a, b) => b[1] - a[1]).slice(0, 5);
1251
+ return customLiveSummary.replace("-dmc", `${danmakuMakerCount}`).replace("-mdn", `${masterInfo.medalName}`).replace("-dca", `${danmakuCount}`).replace("-un1", `${top5DanmakuMaker[0][0]}`).replace("-dc1", `${top5DanmakuMaker[0][1]}`).replace("-un2", `${top5DanmakuMaker[1][0]}`).replace("-dc2", `${top5DanmakuMaker[1][1]}`).replace("-un3", `${top5DanmakuMaker[2][0]}`).replace("-dc3", `${top5DanmakuMaker[2][1]}`).replace("-un4", `${top5DanmakuMaker[3][0]}`).replace("-dc4", `${top5DanmakuMaker[3][1]}`).replace("-un5", `${top5DanmakuMaker[4][0]}`).replace("-dc5", `${top5DanmakuMaker[4][1]}`).replaceAll("\\n", "\n");
1252
+ })();
1249
1253
  await this.broadcastToTargets(sub.uid, [img, summary], PushType.WordCloudAndLiveSummary);
1250
1254
  Object.keys(danmakuWeightRecord).forEach((key) => delete danmakuWeightRecord[key]);
1251
1255
  Object.keys(danmakuMakerRecord).forEach((key) => delete danmakuMakerRecord[key]);
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": "3.3.11",
4
+ "version": "3.3.12-alpha.1",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [