7b48f9bc21
* 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
26 lines
532 B
JavaScript
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)
|
|
}
|