From b54e5aaf80d1bec69bdb8faa747b6e37281da3e6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 11 Aug 2018 21:16:52 +0900 Subject: [PATCH] =?UTF-8?q?=E5=8F=97=E3=81=91=E5=8F=96=E3=81=A3=E3=81=9F?= =?UTF-8?q?=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=82=92=E6=97=A2?= =?UTF-8?q?=E8=AA=AD=E3=81=AB=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/ai.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/ai.ts b/src/ai.ts index 9d78903..065fde5 100644 --- a/src/ai.ts +++ b/src/ai.ts @@ -84,18 +84,20 @@ export default class 藍 { private onMention = (msg: MessageLike) => { console.log(`mention received: ${msg.id}`); - // リアクションする - if (!msg.isMessage) { - setTimeout(() => { - request.post(`${config.apiUrl}/notes/reactions/create`, { - json: { - i: config.i, - noteId: msg.id, - reaction: 'love' - } + setTimeout(() => { + if (msg.isMessage) { + // 既読にする + this.api(`${config.apiUrl}/messaging/messages/read`, { + messageId: msg.id, }); - }, 1000); - } + } else { + // リアクションする + this.api(`${config.apiUrl}/notes/reactions/create`, { + noteId: msg.id, + reaction: 'love' + }); + } + }, 1000); this.modules.filter(m => m.hasOwnProperty('onMention')).some(m => { return m.onMention(msg);