From 4479e7fc2b2631a56888a38d46fe3cf528ce3e33 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 8 Nov 2018 17:45:59 -0500 Subject: [PATCH] don't notify typing for commands --- src/index.js | 9 +++++---- src/ui.js | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/index.js b/src/index.js index a3bdce5..53a52e5 100644 --- a/src/index.js +++ b/src/index.js @@ -103,7 +103,7 @@ ui.logEntry(`Rejoining Channels....`); await status.connect("ws://localhost:8546"); const pubKey = await status.getPublicKey(); const userName = await status.getUserName(); - + ui.logEntry(`PK: ${pubKey}`); ui.logEntry(`-----------------------------------------------------------`); @@ -112,7 +112,7 @@ ui.logEntry(`Rejoining Channels....`); if(err) { return console.log(err); } - }); + }); setInterval(function() { const channel = channels.getCurrentChannel(); @@ -187,7 +187,7 @@ ui.logEntry(`Rejoining Channels....`); ui.logEntry(`Invalid account`.red); return; } - + // TODO:resolve ens username const user = Object.values(channels.allUsers.users).find(x => x.username == destination); if(user){ @@ -212,8 +212,9 @@ ui.logEntry(`Rejoining Channels....`); } }); - ui.events.on('typing', () => { + ui.events.on('typing', (currentText) => { // TODO: use async.cargo instead and/or a to avoid unnecessary requests + if (currentText[0] === '/') return; const channel = channels.getCurrentChannel(); if(!channel.pubKey){ // TODO: the json message is being displayed in the UI diff --git a/src/ui.js b/src/ui.js index 1b353d7..f0e920d 100644 --- a/src/ui.js +++ b/src/ui.js @@ -243,7 +243,7 @@ class UI { }); this.input.key('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''), function () { - self.events.emit("typing"); + self.events.emit("typing", self.input.value); }); this.input.on('submit', this.submitCmd.bind(this));