I want to make it so my bot can reply to the slash command with images. my plan here is to use MessageAttachment to get the images URL and call it using await interaction. This is the error I am getting from logs
iam using dicord js v13
2021-09-24T03:27:36.954175+00:00 app[service.1]: at Object.execute (/app/commands/cook.js:13:27)
2021-09-24T03:27:36.954175+00:00 app[service.1]: at Client.<anonymous> (/app/index.js:28:17)
2021-09-24T03:27:36.954176+00:00 app[service.1]: at Client.emit (node:events:394:28)
2021-09-24T03:27:36.954177+00:00 app[service.1]: at InteractionCreateAction.handle (/app/node_modules/discord.js/src/client/actions/InteractionCreate.js:66:12)
2021-09-24T03:27:36.954178+00:00 app[service.1]: at Object.module.exports [as INTERACTION_CREATE] (/app/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36)
2021-09-24T03:27:36.954178+00:00 app[service.1]: at WebSocketManager.handlePacket (/app/node_modules/discord.js/src/client/websocket/WebSocketManager.js:345:31)
2021-09-24T03:27:36.954179+00:00 app[service.1]: at WebSocketShard.onPacket (/app/node_modules/discord.js/src/client/websocket/WebSocketShard.js:443:22)
2021-09-24T03:27:36.954179+00:00 app[service.1]: at WebSocketShard.onMessage (/app/node_modules/discord.js/src/client/websocket/WebSocketShard.js:300:10)
2021-09-24T03:27:36.954180+00:00 app[service.1]: at WebSocket.onMessage (/app/node_modules/ws/lib/event-target.js:132:16)
2021-09-24T03:27:36.954180+00:00 app[service.1]: at WebSocket.emit (node:events:394:28)
Here is my code
const { SlashCommandBuilder } = require('@discordjs/builders');
const { Message, MessageAttachment } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('cook')
.setDescription('aaa'),
async execute(interaction) {
const imagecook = new MessageAttachment('https://cdn.discordapp.com/attachments/587243063932354560/861940902359728128/gurucooking_long.png');
await interaction.replay({attachment: [imagecook]});
I think you just misspelled replay because it should be interaction.reply()