This commit is contained in:
jane 2020-11-12 04:48:33 -05:00
parent 8a3f399b1f
commit 97393e3ce2
4 changed files with 45 additions and 7 deletions

View file

@ -12,6 +12,10 @@ class LightsParser extends Command {
name = 'lights';
whitelist = true;
func(msg, args, ctx) {
if (ctx.sleep) {
msg.channel.createMessage('i have sleep mode enabled. the lights are probably off.');
return;
}
if (!args.length) {
msg.channel.createMessage('no args found.');
return;
@ -31,11 +35,23 @@ class LightsParser extends Command {
msg.channel.createMessage(`${response}`);
},
(error) => {
msg.channel.createMessage(`error.`);
msg.channel.createMessage(`error: ${error.message}`);
}
);
}
}
initializer.addCommand(new LightsParser());
class Sleep extends Command {
name = 'sleep';
whitelist = true;
func(msg, args, ctx) {
let sleep = ctx.sleep;
sleep = !sleep;
msg.channel.createMessage(`sleep mode is now ${sleep ? 'on' : 'off'}`);
ctx.set_ctx('sleep', sleep);
}
}
initializer.addCommand(new Sleep());
export default initializer;