26 lines
649 B
JavaScript
26 lines
649 B
JavaScript
import {CommandInitializer, Command} from "../parser.js";
|
|
import parse, {instructions} from "../lights/light_parser.js";
|
|
|
|
const initializer = new CommandInitializer();
|
|
|
|
class LightsParser extends Command {
|
|
init(ctx, log) {
|
|
this.log = log;
|
|
}
|
|
name = "lights";
|
|
func(msg, args, ctx) {
|
|
let instructions = parse(args[0]);
|
|
|
|
this.log.debug(instructions);
|
|
let res = "```\n";
|
|
instructions.forEach(instruction => {
|
|
res += JSON.stringify(instruction) + "\n";
|
|
});
|
|
res += "```";
|
|
msg.channel.createMessage(`parsed instructions:\n${res}`);
|
|
}
|
|
}
|
|
initializer.addCommand(new LightsParser());
|
|
|
|
export default initializer;
|