From d4cd674d7a735addac229ef8b78e39d60d00657e Mon Sep 17 00:00:00 2001 From: Lewis Dale Date: Wed, 8 Feb 2017 19:31:23 +0000 Subject: [PATCH] Modifications to commands system, begun work on proper video module --- .gitignore | 1 + janet.js | 19 ++++++++++--------- modules/video.js | 5 +++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index de4931a..09123e7 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ node_modules # Notepad++ backups # *.bak +config.json diff --git a/janet.js b/janet.js index 68565f4..59b524c 100644 --- a/janet.js +++ b/janet.js @@ -8,7 +8,6 @@ class Janet { constructor() { this.config = this.loadConfig() - this.events = PubSub this.loadModules() @@ -16,7 +15,8 @@ class Janet { this.config.irc.server, this.config.irc.user, { - channels: this.config.irc.channels + channels: this.config.irc.channels, + port: this.config.irc.port } ) @@ -26,14 +26,15 @@ class Janet { } console.log("DEBUG: A message was received") - let commandEnd = message.indexOf('?') - if(message.substr(0,6) === "Janet," && commandEnd !== -1) { - let command = message.substr(0,commandEnd + 1).replace('Janet, ','').trim() - let variables = message.substr(commandEnd + 1, message.length).split(',') + console.log(text) + let commandEnd = text.indexOf('?') + if(text.substr(0,6) === "Janet," && commandEnd !== -1) { + let command = text.substr(0,commandEnd + 1).replace('Janet, ','').trim() + let variables = text.substr(commandEnd + 1, text.length).split(',') this.events.publish('message: ' + command, { from: from, to: to, - message: message, + message: text, variables: variables }) } @@ -52,8 +53,8 @@ class Janet { for(let match of matches) { let verb = match.terms[0] let noun = match.terms[2] - this.events.publish('pm: ' + verb.text, { - function: noun.text, + this.events.publish('pm: ' + noun.text, { + module: verb.text, from: nick, text: text, }) diff --git a/modules/video.js b/modules/video.js index 7657f4d..912a321 100644 --- a/modules/video.js +++ b/modules/video.js @@ -11,14 +11,15 @@ class Video extends JanetModule { super({ name: 'Video', showInHelp: true, - command: 'play', + command: 'video', methods: ['pm', 'message'] }, client) } respond(evt, data) { let msg = nlp(data.text) - console.log(msg) + + console.log(msg.match('" * "')) } }