ai/src/modules/ping/index.ts

25 lines
453 B
TypeScript
Raw Normal View History

2019-01-14 15:14:22 +00:00
import autobind from 'autobind-decorator';
import Module from '../../module';
2019-01-15 09:47:22 +00:00
import Message from '../../message';
2018-08-11 06:26:25 +00:00
2019-01-14 15:14:22 +00:00
export default class PingModule extends Module {
2018-08-30 23:20:49 +00:00
public readonly name = 'ping';
2019-01-14 15:14:22 +00:00
@autobind
public install() {
return {
2019-01-15 03:01:58 +00:00
mentionHook: this.mentionHook
2019-01-14 15:14:22 +00:00
};
}
2018-08-11 06:26:25 +00:00
2019-01-14 15:14:22 +00:00
@autobind
2019-01-15 09:47:22 +00:00
private mentionHook(msg: Message) {
if (msg.text && msg.text.includes('ping')) {
2018-08-11 06:26:25 +00:00
msg.reply('PONG!');
return true;
} else {
return false;
}
}
}