2023-01-29 17:39:28 +09:00

28 lines
631 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Message from '@/message';
import Module from '@/module';
import autobind from 'autobind-decorator';
export default class extends Module {
public readonly name = 'is-nani';
@autobind
public install() {
return {
mentionHook: this.mentionHook
};
}
@autobind
private async mentionHook(message: Message) {
if (!message.includes(['って何', 'ってなに', 'ってにゃに', ':is_nani:'])) return false;
const match = message.extractedText.match(/(.+?)って(何|なに|にゃに)/);
if (match) {
message.reply(`Google先生に聞いてみた\n${match[1]} 検索`);
}
return true;
}
}