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 #
|
# Notepad++ backups #
|
||||||
*.bak
|
*.bak
|
||||||
|
|
||||||
|
config.json
|
||||||
|
19
janet.js
19
janet.js
@ -8,7 +8,6 @@ class Janet {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.config = this.loadConfig()
|
this.config = this.loadConfig()
|
||||||
|
|
||||||
this.events = PubSub
|
this.events = PubSub
|
||||||
|
|
||||||
this.loadModules()
|
this.loadModules()
|
||||||
@ -16,7 +15,8 @@ class Janet {
|
|||||||
this.config.irc.server,
|
this.config.irc.server,
|
||||||
this.config.irc.user,
|
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")
|
console.log("DEBUG: A message was received")
|
||||||
let commandEnd = message.indexOf('?')
|
console.log(text)
|
||||||
if(message.substr(0,6) === "Janet," && commandEnd !== -1) {
|
let commandEnd = text.indexOf('?')
|
||||||
let command = message.substr(0,commandEnd + 1).replace('Janet, ','').trim()
|
if(text.substr(0,6) === "Janet," && commandEnd !== -1) {
|
||||||
let variables = message.substr(commandEnd + 1, message.length).split(',')
|
let command = text.substr(0,commandEnd + 1).replace('Janet, ','').trim()
|
||||||
|
let variables = text.substr(commandEnd + 1, text.length).split(',')
|
||||||
this.events.publish('message: ' + command, {
|
this.events.publish('message: ' + command, {
|
||||||
from: from,
|
from: from,
|
||||||
to: to,
|
to: to,
|
||||||
message: message,
|
message: text,
|
||||||
variables: variables
|
variables: variables
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -52,8 +53,8 @@ class Janet {
|
|||||||
for(let match of matches) {
|
for(let match of matches) {
|
||||||
let verb = match.terms[0]
|
let verb = match.terms[0]
|
||||||
let noun = match.terms[2]
|
let noun = match.terms[2]
|
||||||
this.events.publish('pm: ' + verb.text, {
|
this.events.publish('pm: ' + noun.text, {
|
||||||
function: noun.text,
|
module: verb.text,
|
||||||
from: nick,
|
from: nick,
|
||||||
text: text,
|
text: text,
|
||||||
})
|
})
|
||||||
|
@ -11,14 +11,15 @@ class Video extends JanetModule {
|
|||||||
super({
|
super({
|
||||||
name: 'Video',
|
name: 'Video',
|
||||||
showInHelp: true,
|
showInHelp: true,
|
||||||
command: 'play',
|
command: 'video',
|
||||||
methods: ['pm', 'message']
|
methods: ['pm', 'message']
|
||||||
}, client)
|
}, client)
|
||||||
}
|
}
|
||||||
|
|
||||||
respond(evt, data) {
|
respond(evt, data) {
|
||||||
let msg = nlp(data.text)
|
let msg = nlp(data.text)
|
||||||
console.log(msg)
|
|
||||||
|
console.log(msg.match('" * "'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user