janet/modules/time.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

26 lines
532 B
JavaScript

const JanetModule = require('./janetmodule')
/**
* A simple command to ask Janet the current time
* @author Lewis Dale
*/
class Time extends JanetModule {
constructor(client) {
super({
name: 'Time',
showInHelp: true,
command: 'what time is it?',
methods: ['message']
}, client)
}
respond(event, data) {
let date = new Date()
this.client.say(data.from + ", it is currently " + date.toTimeString())
}
}
module.exports = (client) => {
return new Time(client)
}