From 7f2ef2155703e111380dd2f3207b363ee074e4f7 Mon Sep 17 00:00:00 2001 From: Last2014 Date: Sun, 3 May 2026 18:49:01 +0900 Subject: [PATCH 1/3] =?UTF-8?q?Chg:=20=E3=82=B3=E3=83=9E=E3=83=B3=E3=83=89?= =?UTF-8?q?=E5=AE=9F=E8=A1=8C=E3=81=AE=E9=9A=9B=E3=81=AB=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E3=81=A8=E9=80=9A=E7=9F=A5=E3=82=92?= =?UTF-8?q?=E6=99=82=E7=B3=BB=E5=88=97=E3=81=AB=E3=82=BD=E3=83=BC=E3=83=88?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/feature/command/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/feature/command/index.ts b/src/feature/command/index.ts index dd97815..f4ef588 100644 --- a/src/feature/command/index.ts +++ b/src/feature/command/index.ts @@ -23,7 +23,9 @@ try { }); if (response.success) { - const notifications = response.data.filter(notification => notification.category === "reply" && typeof notification.valueid === "string"); + const notifications = response.data + .filter(notification => notification.category === "reply" && typeof notification.valueid === "string") + .sort((a, b) => new Date(b.datetime).getTime() - new Date(a.datetime).getTime()); const mem = Memory.memory; const lastReadReply = mem.lastReadReply; @@ -60,7 +62,8 @@ try { }); if (response.success) { - const mentions = response.data; + const mentions = response.data + .sort((a, b) => new Date(b.datetime).getTime() - new Date(a.datetime).getTime()); const mem = Memory.memory; const lastReadMention = mem.lastReadMention; -- 2.52.0 From 4f2be0e0ed7e6c0e3a88a4192bea9505798bf5b9 Mon Sep 17 00:00:00 2001 From: Last2014 Date: Sun, 3 May 2026 19:12:27 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Chg:=20for=E3=83=AB=E3=83=BC=E3=83=97?= =?UTF-8?q?=E5=86=85=E3=81=A7lastRead*=E3=82=92=E8=A8=98=E9=8C=B2=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=20/=20Chg:=20lastRead*?= =?UTF-8?q?=E3=82=92=E6=99=82=E5=88=BB=E3=83=99=E3=83=BC=E3=82=B9=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/feature/command/index.ts | 33 ++++++++++++++++++++++----------- src/lib/memory.ts | 4 ++-- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/feature/command/index.ts b/src/feature/command/index.ts index f4ef588..6adefa5 100644 --- a/src/feature/command/index.ts +++ b/src/feature/command/index.ts @@ -29,16 +29,11 @@ try { const mem = Memory.memory; const lastReadReply = mem.lastReadReply; - mem.lastReadReply = notifications[0]?.valueid ?? lastReadReply; - Memory.memory = mem; - for (const notification of notifications) { + for (const [index, notification] of notifications.entries()) { if (notification.category !== "reply" || typeof notification.valueid !== "string") continue; - if (lastReadReply === notification.valueid) - break; - const ueuseResponse = await client.request("ueuse/get", { uniqid: notification.valueid, }); @@ -48,6 +43,17 @@ try { continue; } + const time = new Date(ueuseResponse.data[0].datetime).getTime(); + + if (index === 0) { + const mem = Memory.memory; + mem.lastReadReply = time; + Memory.memory = mem; + } + + if (lastReadReply >= time) + break; + ueuses.push(ueuseResponse.data[0]); } } else { @@ -67,14 +73,19 @@ try { const mem = Memory.memory; const lastReadMention = mem.lastReadMention; - mem.lastReadMention = mentions[0]?.uniqid ?? lastReadMention; - Memory.memory = mem; - for (const mention of mentions) { - if (lastReadMention === mention.uniqid) { - break; + for (const [index, mention] of mentions.entries()) { + const time = new Date(mention.datetime).getTime(); + + if (index === 0) { + const mem = Memory.memory; + mem.lastReadMention = time; + Memory.memory = mem; } + if (lastReadMention >= time) + break; + ueuses.push(mention); } } else { diff --git a/src/lib/memory.ts b/src/lib/memory.ts index f0c6962..5e89aec 100644 --- a/src/lib/memory.ts +++ b/src/lib/memory.ts @@ -11,8 +11,8 @@ class MemoryClass { writeFileSync(path, JSON.stringify({ processedInfo: [], permissions: {}, - lastReadMention: "", - lastReadReply: "", + lastReadMention: 0, + lastReadReply: 0, userid: "", max_length: 0, })); -- 2.52.0 From 165500e71d063c968cda4e4736d9e30404987ff5 Mon Sep 17 00:00:00 2001 From: Last2014 Date: Sun, 3 May 2026 19:18:58 +0900 Subject: [PATCH 3/3] =?UTF-8?q?2026.4.3=20/=20Chg:=20=E3=82=B3=E3=83=9E?= =?UTF-8?q?=E3=83=B3=E3=83=89=E5=AE=9F=E8=A1=8C=E3=81=AE=E9=9A=9B=E3=81=AB?= =?UTF-8?q?=E3=83=A1=E3=83=B3=E3=82=B7=E3=83=A7=E3=83=B3=E3=81=A8=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E3=82=92=E6=99=82=E7=B3=BB=E5=88=97=E3=81=AB=E3=82=BD?= =?UTF-8?q?=E3=83=BC=E3=83=88=E3=81=97=E3=81=AA=E3=81=84=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/feature/command/index.ts | 7 ++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02f803d..fdff6af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 2026.4.3 +- Chg: forループ内でlastReadを記録するように +- Chg: lastReadを時刻ベースに + # 2026.4.2 - Fix: id除外が機能しない問題 diff --git a/package.json b/package.json index 3b8a044..ba3934d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "notice-uwuzu", - "version": "2026.4.2", + "version": "2026.4.3", "type": "module", "main": "dist/index.js", "scripts": { diff --git a/src/feature/command/index.ts b/src/feature/command/index.ts index 6adefa5..eb7705c 100644 --- a/src/feature/command/index.ts +++ b/src/feature/command/index.ts @@ -23,9 +23,7 @@ try { }); if (response.success) { - const notifications = response.data - .filter(notification => notification.category === "reply" && typeof notification.valueid === "string") - .sort((a, b) => new Date(b.datetime).getTime() - new Date(a.datetime).getTime()); + const notifications = response.data.filter(notification => notification.category === "reply" && typeof notification.valueid === "string"); const mem = Memory.memory; const lastReadReply = mem.lastReadReply; @@ -68,8 +66,7 @@ try { }); if (response.success) { - const mentions = response.data - .sort((a, b) => new Date(b.datetime).getTime() - new Date(a.datetime).getTime()); + const mentions = response.data; const mem = Memory.memory; const lastReadMention = mem.lastReadMention; -- 2.52.0