diff --git a/src/inc/clients/tg.js b/src/inc/clients/tg.js index da1300a..873cd77 100644 --- a/src/inc/clients/tg.js +++ b/src/inc/clients/tg.js @@ -12,8 +12,13 @@ class tg { this.client.on('message', msg => { if (msg.date >= (~~(Date.now() / 1000) - 10)) { - msg.text = msg.text.match(/^\//g) ? msg.text.replace(/^\//g, "\.") : msg.text; - this.emit('data', ['message', this.reply(msg)]); + try { + msg.text = msg.text && msg.text.match(/^\//g) ? msg.text.replace(/^\//g, "\.") : msg.text; + this.emit('data', ['message', this.reply(msg)]); + } + catch(err) { + console.log(err); + } } }); }