From 80a8b68d8c02c51fee20abc8f9c265c0daeb6140 Mon Sep 17 00:00:00 2001 From: na2na-p Date: Thu, 17 Feb 2022 15:44:16 +0900 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E3=81=91=E3=82=8B=E6=84=8F=E5=91=B3?= =?UTF-8?q?=E3=81=8C=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F=E3=81=AE=E3=81=A7?= =?UTF-8?q?=E5=90=88=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.ts | 2 -- src/modules/emoji-react/index.ts | 9 ++++++ src/modules/okng/index.ts | 48 -------------------------------- 3 files changed, 9 insertions(+), 50 deletions(-) delete mode 100644 src/modules/okng/index.ts diff --git a/src/index.ts b/src/index.ts index b61f300..5ecb258 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,7 +16,6 @@ import TalkModule from './modules/talk'; import BirthdayModule from './modules/birthday'; import ReversiModule from './modules/reversi'; import PingModule from './modules/ping'; -import okngModule from './modules/okng'; import EmojiModule from './modules/emoji'; import EmojiReactModule from './modules/emoji-react'; import FortuneModule from './modules/fortune'; @@ -70,7 +69,6 @@ promiseRetry(retry => { // 藍起動 new 藍(account, [ new CoreModule(), - new okngModule(), new EmojiModule(), new EmojiReactModule(), new FortuneModule(), diff --git a/src/modules/emoji-react/index.ts b/src/modules/emoji-react/index.ts index e671b4d..e716493 100644 --- a/src/modules/emoji-react/index.ts +++ b/src/modules/emoji-react/index.ts @@ -36,6 +36,15 @@ export default class extends Module { }); }; + if (includes(note.text, ['いい']) && (includes(note.text, ["?"]) || includes(note.text, ["?"]))) { + // 50%の確率で":dame:"または":yattare:"を返す + if (Math.random() < 0.5) { + return react(':dame:', true); + } else { + return react(':yattare:', true); + } + } + const customEmojis = note.text.match(/:([^\n:]+?):/g); if (customEmojis) { // カスタム絵文字が複数種類ある場合はキャンセル diff --git a/src/modules/okng/index.ts b/src/modules/okng/index.ts deleted file mode 100644 index ac07655..0000000 --- a/src/modules/okng/index.ts +++ /dev/null @@ -1,48 +0,0 @@ -import autobind from 'autobind-decorator'; -import { parse } from 'twemoji-parser'; -const delay = require('timeout-as-promise'); - -import { Note } from '@/misskey/note'; -import Module from '@/module'; -import Stream from '@/stream'; -import includes from '@/utils/includes'; - -export default class extends Module { - public readonly name = 'okng'; - - private htl: ReturnType; - - @autobind - public install() { - this.htl = this.ai.connection.useSharedConnection('homeTimeline'); - this.htl.on('note', this.onNote); - - return {}; - } - - @autobind - private async onNote(note: Note) { - if (note.reply != null) return; - if (note.text == null) return; - if (note.text.includes('@')) return; // (自分または他人問わず)メンションっぽかったらreject - - const react = async (reaction: string, immediate = false) => { - if (!immediate) { - await delay(1500); - } - this.ai.api('notes/reactions/create', { - noteId: note.id, - reaction: reaction - }); - }; - - if (includes(note.text, ['いい']) && (includes(note.text, ["?"]) || includes(note.text, ["?"]))) { - // 50%の確率で":dame:"または":yattare:"を返す - if (Math.random() < 0.5) { - return react(':dame:'); - } else { - return react(':yattare:'); - } - } - } -}