ai/src/modules/ping/index.ts
na2na e5e9d0076e 😇
2022-02-17 00:46:40 +09:00

32 lines
623 B
TypeScript

import autobind from 'autobind-decorator';
import Module from '@/module';
import Message from '@/message';
export default class extends Module {
public readonly name = 'ping';
@autobind
public install() {
return {
mentionHook: this.mentionHook
};
}
@autobind
private async mentionHook(msg: Message) {
if (msg.text && (msg.text.includes('ping') || msg.text.includes('おい'))) {
if (msg.text.includes('おい')) {
msg.reply('はい。。。', {
immediate: true
});
} else {
msg.reply('PONG!', {
immediate: true
});
}
return true;
} else {
return false;
}
}
}