koishi-plugin-ll-mc 3.0.0 → 3.0.2
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
404: Not Found
|
|
Binary file
|
package/lib/index.js
CHANGED
|
@@ -376,7 +376,7 @@ async function apply(ctx, config) {
|
|
|
376
376
|
} catch (error) {
|
|
377
377
|
logger.warn("无法加载 fallbackBase64.json,将使用空的回退头像。", error);
|
|
378
378
|
}
|
|
379
|
-
const fontFiles = ["HarmonyOS_Sans_Medium.ttf"];
|
|
379
|
+
const fontFiles = ["HarmonyOS_Sans_Medium.ttf", "NotoEmoji.ttf"];
|
|
380
380
|
for (const fontFile of fontFiles) {
|
|
381
381
|
await copyAssetIfNotExists(
|
|
382
382
|
import_path.default.join(assetsDir, "fonts"),
|
|
@@ -528,12 +528,13 @@ async function apply(ctx, config) {
|
|
|
528
528
|
processedMessages.set(dedupKey, Date.now() + MESSAGE_DEDUP_TTL);
|
|
529
529
|
}
|
|
530
530
|
let sessionChannelName = session.event.channel.name;
|
|
531
|
-
|
|
531
|
+
// 群昵称优先:群名片/群昵称(官机原始事件 member.nick,OneBot 的 member.name/card)
|
|
532
|
+
let username = sanitizeText(author?.nickname || author?.nick);
|
|
532
533
|
if (!username) {
|
|
533
|
-
// 官机补丁:官方QQ原始事件自带 member.nick / author.username,零 API
|
|
534
534
|
const raw = session.event?._data?.d;
|
|
535
|
-
username = sanitizeText(raw?.member?.nick
|
|
535
|
+
username = sanitizeText(raw?.member?.nick);
|
|
536
536
|
}
|
|
537
|
+
if (!username) username = sanitizeText(author?.name || author?.username);
|
|
537
538
|
if (!username) username = userId;
|
|
538
539
|
const userAvatar = author?.avatar;
|
|
539
540
|
try {
|
|
@@ -1861,7 +1862,7 @@ ${targetUserRecord[0].username}
|
|
|
1861
1862
|
let context = canvas.getContext('2d');
|
|
1862
1863
|
|
|
1863
1864
|
// 根据最大计数的文本宽度动态调整画布宽度,以防数字溢出
|
|
1864
|
-
context.font = \`30px "\${config.chartNicknameFont}", HarmonyOS_Sans_Medium, "Microsoft YaHei", sans-serif\`;
|
|
1865
|
+
context.font = \`30px "\${config.chartNicknameFont}", HarmonyOS_Sans_Medium, "Microsoft YaHei", "NotoEmoji", sans-serif\`;
|
|
1865
1866
|
// 找到拥有最大发言数的条目,因为它的文本通常最长
|
|
1866
1867
|
const maxCountData = rankingData.find(d => d.count === maxCount) || rankingData[0] || { count: 1, percentage: 0 };
|
|
1867
1868
|
let maxCountText = maxCount.toString();
|
|
@@ -1949,7 +1950,7 @@ ${targetUserRecord[0].username}
|
|
|
1949
1950
|
|
|
1950
1951
|
async function drawTextAndIcons(context, data, index, avgColor, barX, barY, barWidth, barHeight) {
|
|
1951
1952
|
// 字体栈包含了用户选择的字体、插件内置字体和通用字体,以确保兼容性。
|
|
1952
|
-
context.font = \`30px "\${config.chartNicknameFont}", HarmonyOS_Sans_Medium, "Microsoft YaHei", sans-serif\`;
|
|
1953
|
+
context.font = \`30px "\${config.chartNicknameFont}", HarmonyOS_Sans_Medium, "Microsoft YaHei", "NotoEmoji", sans-serif\`;
|
|
1953
1954
|
const textY = barY + barHeight / 2 + 10.5;
|
|
1954
1955
|
|
|
1955
1956
|
|
|
@@ -2515,6 +2516,7 @@ ${targetUserRecord[0].username}
|
|
|
2515
2516
|
if (!config.showStarInChart && newItem.name.startsWith("★")) {
|
|
2516
2517
|
newItem.name = newItem.name.substring(1);
|
|
2517
2518
|
}
|
|
2519
|
+
// 官机补丁:emoji 走 NotoEmoji 字体回退(画布字体栈里加了 NotoEmoji),真正显示 emoji
|
|
2518
2520
|
return newItem;
|
|
2519
2521
|
});
|
|
2520
2522
|
await Promise.all(
|