1
0
mirror of https://github.com/Daichimarukana/uwuzu.git synced 2026-06-04 19:14:41 +00:00

uwuzu v1.6.1 Hapuego

This commit is contained in:
だいちまる
2025-08-05 15:51:55 +09:00
parent e15b52a205
commit a74abbf5c0
6 changed files with 26 additions and 88 deletions
+5 -5
View File
@@ -32,7 +32,7 @@ async function replaceMentions(text) {
}
// ユーザーIDを小文字に正規化
const uniqueMentions = [...new Set(mentionMatches.map(match => match[1].toLowerCase()))];
const uniqueMentions = [...new Set(mentionMatches.map(match => match[1]))];
const mentionsToFetch = uniqueMentions.filter(userID => !mentionCache[userID]);
if (mentionsToFetch.length > 0) {
@@ -51,9 +51,9 @@ async function replaceMentions(text) {
if (response.success && response.users) {
for (const [name, userInfo] of Object.entries(response.users)) {
if (userInfo && userInfo.userid && userInfo.username) {
mentionCache[name.toLowerCase()] = `<a href="/@${userInfo.userid}" class="mta">@${userInfo.username}</a>`;
mentionCache[name] = `<a href="/@${userInfo.userid}" class="mta">@${userInfo.username}</a>`;
} else {
mentionCache[name.toLowerCase()] = `@${name}`;
mentionCache[name] = `@${name}`;
}
}
}
@@ -61,7 +61,7 @@ async function replaceMentions(text) {
},
error: function () {
for (const name of mentionsToFetch) {
mentionCache[name.toLowerCase()] = `@${name}`;
mentionCache[name] = `@${name}`;
}
resolve();
}
@@ -71,7 +71,7 @@ async function replaceMentions(text) {
// 元のtextに適用(小文字で照合)
text = text.replace(/@([a-zA-Z0-9_]+)/g, (_, id) => {
const lower = id.toLowerCase();
const lower = id;
return mentionCache[lower] || `@${id}`; // 表示は元の大文字小文字を保持
});