I just started coding a Discord bot, and I'm having a problem with coding with Giphy API. I don't know if the entire code is wrong, but anyways I'm confused with it. How do I fix the problem?
The first If-Then statement doesn't give out any errors, but the second one in the code does give out an error.
I'm using Visual Studio Code to code, and Discord.js as the Node.js module.
client.on('message', message =>{
//console.log(message.content);
if(message.content.startsWith(`${prefix}`)) {
message.channel.send("oh yeah it's the prefix of the bot")
}
if(message.content.startsWith(`${prefix}gif`)) {
giphy.trending("gifs", {})
.then((response) => {
var totalResponses = response.data.length;
var responseIndex = Math.floor((Math.random() * 10) +1) % totalResponses;
var responseFinal = response.data[responseIndex]
message.channel.send("There you go!", {
files: [responseFinal.images.fixed_height.url]
})
file
})
})
The error:
Declaration or statement expected ts(1128)