Hello, I am using Glitch to make a Discord bot with Eris. I have the following code in one portion of it:
bot.registerCommand('giphy', (msg, args) => {
if(args.length === 0) {
return "Invalid input";
}
var textcontent = args.join(" ");
request = new XMLHttpRequest;
request.open('GET', 'http://api.giphy.com/v1/gifs/translate?api_key=' + process.env.GIPHY_TOKEN + '&s=' + textcontent, true);
request.onload = function() {
if (request.status >= 200 && request.status < 400){
data = JSON.parse(request.responseText).data.embed_url;
console.log(data);
return data;
} else {
console.log('reached giphy, but API returned an error');
return "error";
}
}, {
description: "Get a gif from GIPHY with keywords",
fullDescription: "This will use GIPHY translate to change keywords to a gif.",
usage: "<keywords>"
}); // on this line, i get an unexpected token ) error
I looked the code over with a friend and neither of us can find any issues. Any thoughts?
EDIT: Exact error:
});
^
SyntaxError: Unexpected token )
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609