janet/modules/greet.js
Lewis Dale 7b48f9bc21 Modifications to module system:
* Renamed Module to JanetModule to reduce chance of clashes with NodeJS module
* Changes to event dispatcher - different PubSub instances for each type of event
* Fixed issues with arguments and scoping when modules triggered
2017-02-03 23:00:23 +00:00

28 lines
497 B
JavaScript

const JanetModule = require('./janetmodule')
/**
* A simple greet module that says a friendly hello when somebody joins
* @author Lewis Dale
*/
class Greet extends JanetModule {
constructor(client) {
super({
name: 'Greet',
showInHelp: false,
command: 'join',
methods: ['join']
}, client)
}
respond(event, who) {
if (who !== "Janet") {
this.client.say("Hello, " + who)
}
}
}
module.exports = (client) => {
return new Greet(client)
}