I have been following a few different guides to program a simple discord bot. Everything works except I cannot get it to send an image. I have looked at these previous questions 1 2, but their solutions are not working for me. This is my code:
const {Client, Intents} = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
const prefix = '?';
client.once('ready', () => {
console.log("Dog is online!");
});
client.on('messageCreate', message => {
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if(command === 'ping') {
message.channel.send('pong!');
}
else if (command === 'bark') {
message.channel.send('bark bark bark grrrr...')
}
else if(command === 'nick') {
message.channel.send('grrr...');
}
else if (command === 'pic') {
message.channel.send("little dog", {files: ["https://i.imgur.com/xxXXXxx.jpeg"] });
}
});
//must be last line
client.login('');
my client login is there in my editor, just not sharing it here. the "pic" command is what is not working. It displays the "little dog" text, but does not send the image. The only reason I'm using imgur is because I'm not sure if you can send local images; if someone knows a solution using local files I'll take it.