ai/src/modules/ping/index.ts

25 lines
460 B
TypeScript
Raw Normal View History

2019-01-14 15:14:22 +00:00
import autobind from 'autobind-decorator';
import Module from '../../module';
2018-08-11 06:26:25 +00:00
import MessageLike from '../../message-like';
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 {
onMention: this.onMention
};
}
2018-08-11 06:26:25 +00:00
2019-01-14 15:14:22 +00:00
@autobind
private onMention(msg: MessageLike) {
if (msg.text && msg.text.includes('ping')) {
2018-08-11 06:26:25 +00:00
msg.reply('PONG!');
return true;
} else {
return false;
}
}
}