initial bot commit
This commit is contained in:
commit
9eda4abcf7
10 changed files with 503 additions and 0 deletions
25
cmd/lights.js
Normal file
25
cmd/lights.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
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;
|
16
cmd/reg.js
Normal file
16
cmd/reg.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {CommandInitializer, Command} from "../parser.js";
|
||||
|
||||
const initializer = new CommandInitializer();
|
||||
|
||||
class PingCommand extends Command {
|
||||
name = "ping";
|
||||
func(msg, args, ctx) {
|
||||
msg.channel.createMessage("p").then(m => {
|
||||
m.edit(`rtt: ${Math.floor(m.timestamp - msg.timestamp)}, gateway: ${ctx.bot.shards.get(ctx.bot.guildShardMap[ctx.bot.channelGuildMap[msg.channel.id]] || 0).latency}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
initializer.addCommand(new PingCommand());
|
||||
|
||||
export default initializer;
|
Loading…
Add table
Add a link
Reference in a new issue