Modifications to commands system, begun work on proper video module
This commit is contained in:
parent
c76f8e27a7
commit
d4cd674d7a
1
.gitignore
vendored
1
.gitignore
vendored
@ -32,3 +32,4 @@ node_modules
|
||||
# Notepad++ backups #
|
||||
*.bak
|
||||
|
||||
config.json
|
||||
|
19
janet.js
19
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,
|
||||
})
|
||||
|
@ -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('" * "'))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user