diff --git a/packages/uplim-info-gmail/src/main.ts b/packages/uplim-info-gmail/src/main.ts index d8ac5bf..279edf5 100644 --- a/packages/uplim-info-gmail/src/main.ts +++ b/packages/uplim-info-gmail/src/main.ts @@ -16,26 +16,30 @@ function main() { if (isLabeled) continue; + const hasUnreadMessage = false; for (const message of thread.getMessages()) { - if (!message.isUnread()) return; - const text = createMessage(message); - - const cutText = - text.length > 2000 ? `${text.substring(0, 1995)}...` : text; - - // biome-ignore lint/style/useTemplate: エスケープめっちゃ必要でむしろ読みにくくなるので - const codeBlock = "```\n" + cutText + "\n```"; - - postMessage({ - username: "info@uplim.co.jp", - parse: "full", - avatar_url: - "https://cdn.discordapp.com/attachments/792765244040675389/921661726863282176/pngegg.png", - content: codeBlock, - }); + if (message.isUnread()) { + const text = createMessage(message); + + const cutText = + text.length > 2000 ? `${text.substring(0, 1995)}...` : text; + + // biome-ignore lint/style/useTemplate: エスケープめっちゃ必要でむしろ読みにくくなるので + const codeBlock = "```\n" + cutText + "\n```"; + + postMessage({ + username: "info@uplim.co.jp", + parse: "full", + avatar_url: + "https://cdn.discordapp.com/attachments/792765244040675389/921661726863282176/pngegg.png", + content: codeBlock, + }); + } } - thread.addLabel(label); + if (hasUnreadMessage) { + thread.addLabel(label); + } } }