Closed AciesGecko closed 2 years ago
In the snippet you provided you're declaring a new function without actually calling it. Like this
await getImage(something here)
But I think you don't need to declare it. You only need to get the image and send it.
message.delete();
const picture = await getImage('cats')
message.channel.send("here cat")
message.channel.send(picture)
Also, getImage
- is an asynchronous function (it returns a Promise
), so you have to put async
in the first line
client.on('messageCreate', async message => {
You can read more about Promises here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises
Thank you so much for the quick reply, all is working fine now!
Hello, I'm so sorry I have no idea what I am doing, I just want to type .cat and make a bot post a random image from a subreddit with cats, I tried a lot of things but nothing works and I can't find a guide on how to use functions, it always give me errors, here's what I wrote:
Can you help me please, I don't even know where to search for help