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-23 11:10:58 +00:00
|
|
|
export default class extends Module {
|
2018-08-30 23:20:49 +00:00
|
|
|
public readonly name = 'ping';
|
2018-08-12 14:03:00 +00:00
|
|
|
|
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) {
|
2018-08-11 12:28:17 +00:00
|
|
|
if (msg.text && msg.text.includes('ping')) {
|
2018-08-11 06:26:25 +00:00
|
|
|
msg.reply('PONG!');
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|