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:'); - } - } - } -}