it works! pog

This commit is contained in:
jane 2020-11-09 01:53:07 -05:00
parent 5966977a76
commit 8a3f399b1f
3 changed files with 11 additions and 2 deletions

View file

@ -28,7 +28,7 @@ class LightsParser extends Command {
req(
instructions.filter((i) => i.valid),
(response) => {
msg.channel.createMessage(`${response.statusCode}`);
msg.channel.createMessage(`${response}`);
},
(error) => {
msg.channel.createMessage(`error.`);

View file

@ -109,7 +109,10 @@ function parseSingleInstruction(str = '') {
item.errors = 'Not enough arguments.';
return item;
}
inst_args = parsed_args[1].split(',').map((s) => (available_targets[s] ? s : parseInt(s.trim())));
inst_args = parsed_args[1]
.split(',')
.map((s) => s.trim())
.map((s) => (available_targets[s] ? s : parseInt(s)));
if (!inst_args.length) {
item.errors = 'No valid args.';
}

View file

@ -24,5 +24,11 @@ export default function req(data, callback, errorCallback) {
client.write(string_data);
}
client.destroy();
callback('success.');
});
client.on('error', (e) => {
client.destroy();
errorCallback(e);
});
}