Browse code

fix commands regex

devnewton authored on 14/01/2018 09:47:57
Showing 1 changed files
... ...
@@ -72,7 +72,7 @@ document.addEventListener('DOMContentLoaded', function () {
72 72
                 return this.handleCommandNick() || this.handleCommandJoin();
73 73
             },
74 74
             handleCommandNick: function () {
75
-                var result = /\/nick (.*)/.exec(this.message);
75
+                var result = /^\/nick (.*)/.exec(this.message);
76 76
                 if (result && result.length === 2) {
77 77
                     localStorage.login = result[1];
78 78
                     return true;
... ...
@@ -81,7 +81,7 @@ document.addEventListener('DOMContentLoaded', function () {
81 81
                 }
82 82
             },
83 83
             handleCommandJoin: function () {
84
-                var result = /\/join ?#?(\w+)?/.exec(this.message);
84
+                var result = /^\/join ?#?(\w+)?/.exec(this.message);
85 85
                 if (result && result.length === 2) {
86 86
                     this.posts = [];
87 87
                     this.room = result[1] || '';