From 7f7bd98099d7b286bbd36e3d5d67bda0db5d4269 Mon Sep 17 00:00:00 2001 From: Lewis Dale Date: Wed, 22 Mar 2023 15:21:29 +0000 Subject: [PATCH] Start bringing Janet back from the dead --- .gitignore | 1 + janet.js | 11 +++-- package-lock.json | 112 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 4 files changed, 119 insertions(+), 7 deletions(-) create mode 100644 package-lock.json diff --git a/.gitignore b/.gitignore index 09123e7..5de8bdc 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ node_modules *.bak config.json +config.json diff --git a/janet.js b/janet.js index 59b524c..9e9f388 100644 --- a/janet.js +++ b/janet.js @@ -16,7 +16,8 @@ class Janet { this.config.irc.user, { channels: this.config.irc.channels, - port: this.config.irc.port + port: this.config.irc.port, + secure: !!this.config.irc.ssl } ) @@ -32,7 +33,7 @@ class Janet { 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, + from: nick, to: to, message: text, variables: variables @@ -48,17 +49,15 @@ class Janet { this.client.addListener('pm', (nick, text, message) => { console.log("DEBUG: A pm was received") let q = nlp(text) - let matches = q.match('#Verb . #Noun').list + let matches = q.match('#Verb+').json(); for(let match of matches) { let verb = match.terms[0] - let noun = match.terms[2] - this.events.publish('pm: ' + noun.text, { + this.events.publish('pm: ' + verb.text, { module: verb.text, from: nick, text: text, }) - } }) } diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..586e5ed --- /dev/null +++ b/package-lock.json @@ -0,0 +1,112 @@ +{ + "name": "janet", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "janet", + "version": "0.0.1", + "license": "MIT", + "dependencies": { + "compromise": "^14.8.2", + "irc": "^0.5.2", + "pubsub-js": "^1.5.4" + } + }, + "node_modules/compromise": { + "version": "14.8.2", + "resolved": "https://registry.npmjs.org/compromise/-/compromise-14.8.2.tgz", + "integrity": "sha512-B/2MxDx2R1U8QlZPZycypvqv/JfSPJSyh/sTUxIuteSja5ABWzHoLpaTGmRiai1GX7wKA1pOSSwtp4XRFGDKnA==", + "dependencies": { + "efrt": "2.7.0", + "grad-school": "0.0.5", + "suffix-thumb": "4.0.2" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/efrt": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/efrt/-/efrt-2.7.0.tgz", + "integrity": "sha512-/RInbCy1d4P6Zdfa+TMVsf/ufZVotat5hCw3QXmWtjU+3pFEOvOQ7ibo3aIxyCJw2leIeAMjmPj+1SLJiCpdrQ==", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/grad-school": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/grad-school/-/grad-school-0.0.5.tgz", + "integrity": "sha512-rXunEHF9M9EkMydTBux7+IryYXEZinRk6g8OBOGDBzo/qWJjhTxy86i5q7lQYpCLHN8Sqv1XX3OIOc7ka2gtvQ==", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/iconv": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/iconv/-/iconv-2.2.3.tgz", + "integrity": "sha512-evIiYeKdt5nEGYKNkQcGPQy781sYgbBKi3gEkt1s4CwteCdOHSjGGRyyp6lP8inYFZwvzG3lgjXEvGUC8nqQ5A==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "nan": "^2.3.5" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/irc": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/irc/-/irc-0.5.2.tgz", + "integrity": "sha512-KnrvkV05Y71SWmRWHtnlWEIH7LA/YeDul6l7tncCGLNEw4B6Obtmkatb3ACnSLj0kOJ6UBiuhss9e+eRG3zlxw==", + "dependencies": { + "irc-colors": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "optionalDependencies": { + "iconv": "~2.2.1", + "node-icu-charset-detector": "~0.2.0" + } + }, + "node_modules/irc-colors": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/irc-colors/-/irc-colors-1.5.0.tgz", + "integrity": "sha512-HtszKchBQTcqw1DC09uD7i7vvMayHGM1OCo6AHt5pkgZEyo99ClhHTMJdf+Ezc9ovuNNxcH89QfyclGthjZJOw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/nan": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", + "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", + "optional": true + }, + "node_modules/node-icu-charset-detector": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/node-icu-charset-detector/-/node-icu-charset-detector-0.2.0.tgz", + "integrity": "sha512-DYOFJ3NfKdxEi9hPbmoCss6WydGhJsxpSleUlZfAWEbZt3AU7JuxailgA9tnqQdsHiujfUY9VtDfWD9m0+ThtQ==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "nan": "^2.3.3" + }, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/pubsub-js": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/pubsub-js/-/pubsub-js-1.9.4.tgz", + "integrity": "sha512-hJYpaDvPH4w8ZX/0Fdf9ma1AwRgU353GfbaVfPjfJQf1KxZ2iHaHl3fAUw1qlJIR5dr4F3RzjGaWohYUEyoh7A==" + }, + "node_modules/suffix-thumb": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/suffix-thumb/-/suffix-thumb-4.0.2.tgz", + "integrity": "sha512-CCvCAr7JyeQoO+/lyq3P2foZI/xJz5kpG3L6kg2CaOf9K2/gaM9ixy/JTuRwjEK38l306zE7vl3JoOZYmLQLlA==" + } + } +} diff --git a/package.json b/package.json index 87fe225..d953a3c 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "author": "Lewis Dale ", "license": "MIT", "dependencies": { - "compromise": "^7.0.6", + "compromise": "^14.8.2", "irc": "^0.5.2", "pubsub-js": "^1.5.4" }