Make Discord bot send picture with message with NodeJS

ClientUser.sendMessage is deprecated, as is the file parameter in its options. You should be using Channel.send(message, options), with files as an array of strings or FileOptions.

bot.on('messageCreate' message => {
    message.channel.send("My Bot's message", {files: ["https://i.imgur.com/XxxXxXX.jpg"]});
});

If you want to stick to your deprecated methods, ClientUser.sendFile might be something of interest to you, though I do recommend you move over to the stuff that’s more current.

Leave a Comment

tech