no longer crashes when invalid equation is entered

This commit is contained in:
Emily 2020-10-03 10:53:16 +10:00
parent ba4781f0f4
commit f31f75ae79

View file

@ -8,6 +8,7 @@ exports.run = (client, message, args) => {
);
}
try {
for (var i = 0; i < exercise.length; i++) {
let c = exercise.charAt(i);
let found = allowed.find((element) => element === c);
@ -23,7 +24,10 @@ exports.run = (client, message, args) => {
let result = (new Function( 'return ' + exercise )());
message.channel.send(`\`RESULT:\`\n\`\`\`${result}\`\`\``);
message.channel.send(`\`RESULT:\`\n\`\`\`${result}\`\`\``)
} catch (err) {
message.channel.send('<:error:466995152976871434> Malformed input.')
}
};
exports.conf = {