From b157d0a86881e687a5e2ec7f4abcc6380c497d36 Mon Sep 17 00:00:00 2001 From: na2na <49822810+na2na-p@users.noreply.github.com> Date: Mon, 13 Jun 2022 23:57:02 +0900 Subject: [PATCH] =?UTF-8?q?=E7=B5=B5=E6=96=87=E5=AD=97=E3=83=AA=E3=82=A2?= =?UTF-8?q?=E3=82=AF=E3=82=B7=E3=83=A7=E3=83=B3=E9=96=A2=E4=BF=82=E3=81=A7?= =?UTF-8?q?=E3=81=84=E3=81=84=E6=84=9F=E3=81=98=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ai.ts | 8 ++++++++ src/config.ts | 1 + src/index.ts | 2 +- src/misskey/note.ts | 7 +++++++ src/modules/emoji-react/index.ts | 7 ++++++- 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/ai.ts b/src/ai.ts index 74d7270..d9bc9a1 100644 --- a/src/ai.ts +++ b/src/ai.ts @@ -507,4 +507,12 @@ export default class 藍 { this.meta.update(rec); } + + /** + * ご主人様かどうかを返します + */ + @autobind + public isMaster(userId: User['id']): boolean { + return config.masterID === userId; + } } diff --git a/src/config.ts b/src/config.ts index 81892a6..86bd26d 100644 --- a/src/config.ts +++ b/src/config.ts @@ -2,6 +2,7 @@ type Config = { host: string; i: string; master?: string; + masterID?: string; wsUrl: string; apiUrl: string; keywordEnabled: boolean; diff --git a/src/index.ts b/src/index.ts index da62caa..2cb044d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -85,7 +85,7 @@ promiseRetry(retry => { new PingModule(), new WelcomeModule(), new ServerModule(), - new FollowModule(), + // new FollowModule(), new BirthdayModule(), new ValentineModule(), new KeywordModule(), diff --git a/src/misskey/note.ts b/src/misskey/note.ts index 7aa0aff..075f9c0 100644 --- a/src/misskey/note.ts +++ b/src/misskey/note.ts @@ -1,6 +1,13 @@ export type Note = { id: string; + createdAt: Date; + userId: string; + user: { + id: string; + }, text: string | null; + cw: string | null; + visibility: "public" | "home" | "followers" | "specified"; reply: any | null; poll?: { choices: { diff --git a/src/modules/emoji-react/index.ts b/src/modules/emoji-react/index.ts index 4f2b74b..133abe4 100644 --- a/src/modules/emoji-react/index.ts +++ b/src/modules/emoji-react/index.ts @@ -91,7 +91,12 @@ export default class extends Module { if (includes(note.text, ['寿司', 'sushi']) || note.text === 'すし') return react('🍣'); if (includes(note.text, ['ずなず']) || includes(note.text, ['ずにゃず'])) return react('🙌'); - if (includes(note.text, ['なず']) || includes(note.text, ['にゃず'])) return react(':google_hart:'); + if (includes(note.text, ['なず']) || includes(note.text, ['にゃず'])) { + if (this.ai.isMaster(note.userId)) { + return react(':google_hart:') + } + return react(':oltu:'); + }; const gameReact = [ ':ysvi:',