Browse Source

new command system with prefix + config

Saegusa 9 years ago
parent
commit
8f7aef0c1a
2 changed files with 11 additions and 1 deletions
  1. 6 0
      config.json
  2. 5 1
      index.js

+ 6 - 0
config.json

@@ -0,0 +1,6 @@
+{
+    "prefix" : "!",
+    "savedOptions" : {
+        
+    }
+}

+ 5 - 1
index.js

@@ -10,6 +10,7 @@ to enable density of the fps
 increase
 */
 
+const config = require('./config.json');
 const format = require('./format.js');
 
 module.exports = function FPSUtils(dispatch) {
@@ -55,9 +56,12 @@ module.exports = function FPSUtils(dispatch) {
 
     dispatch.hook('C_CHAT', 1, function(event) {
 
+        if(event.authorName != player || format.stripTags(event.message).split('')[0] != config.prefix)
+            return;
+
             let command = format.stripTags(event.message).split(' ');
 
-            if(command[0] === 'fps') {
+            if(command[0] === config.prefix + 'fps') {
 
                 lastlagstate = lagstate;