Janet now uses the compromise library to process commands, meaning she has NLP! Commands now only have to contain the right phrases, e.g. "play a video" and "play the video" both trigger the same command, regardless of the rest of the text
Simplified the events dispatcher because shared memory references were causing events to be dispatched multiple times
This commit is contained in:
1 parent
deb70524cd
commit
c76f8e27a7
5 files changed
+56
-19
No files matched your search
+1
-1
@@ -8,7 +8,7 @@ class Commands extends JanetModule {
|
||||
name: 'Commands',
|
||||
command: 'what commands are available?',
|
||||
showInHelp: true,
|
||||
methods: ['message'],
|
||||
methods: ['message', 'pm'],
|
||||
}, client)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ class Reload extends JanetModule {
|
||||
super({
|
||||
name: 'Reload',
|
||||
showInHelp: false,
|
||||
command: 'reload',
|
||||
command: 'load',
|
||||
methods: ['pm']
|
||||
}, client)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
const nlp = require('compromise')
|
||||
|
||||
const JanetModule = require('./janetmodule')
|
||||
|
||||
/**
|
||||
* Command to get Janet to search YouTube for a video
|
||||
* @author Lewis Dale
|
||||
*/
|
||||
class Video extends JanetModule {
|
||||
constructor(client) {
|
||||
super({
|
||||
name: 'Video',
|
||||
showInHelp: true,
|
||||
command: 'play',
|
||||
methods: ['pm', 'message']
|
||||
}, client)
|
||||
}
|
||||
|
||||
respond(evt, data) {
|
||||
let msg = nlp(data.text)
|
||||
console.log(msg)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = (client) => {
|
||||
return new Video(client)
|
||||
}
|
||||
Reference in new issue
Block a user