From 93532bcf7fffd746fc5e2223945ca63fdb28b05d Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 15 Jan 2019 18:52:20 +0900 Subject: [PATCH] =?UTF-8?q?Bot=E3=81=AF=E7=84=A1=E8=A6=96=E3=81=99?= =?UTF-8?q?=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 | 6 ++++++ src/misskey/user.ts | 1 + 2 files changed, 7 insertions(+) diff --git a/src/ai.ts b/src/ai.ts index 3e97984..1d413f8 100644 --- a/src/ai.ts +++ b/src/ai.ts @@ -130,6 +130,12 @@ export default class 藍 { private async onReceiveMessage(msg: Message): Promise { this.log(chalk.gray(`<<< An message received: ${chalk.underline(msg.id)}`)); + // Ignore message if the user is a bot + // To avoid infinity reply loop. + if (msg.user.isBot) { + return; + } + const isNoContext = !msg.isDm && msg.replyId == null; // Look up the context diff --git a/src/misskey/user.ts b/src/misskey/user.ts index d2438cc..7206d2b 100644 --- a/src/misskey/user.ts +++ b/src/misskey/user.ts @@ -3,4 +3,5 @@ export type User = { name: string; username: string; isFollowing: boolean; + isBot: boolean; };