From 9babb3b8ded3fff8e307f8dadcae1227330785d0 Mon Sep 17 00:00:00 2001 From: Flummi Date: Mon, 13 Nov 2017 16:27:06 +0100 Subject: [PATCH] ... --- src/inc/clients/tg.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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); + } } }); }