1 | initial version |
Yes, selfbot messages in discord.js can have locally uploaded images attached to them. You can use the Discord.MessageAttachment
class to attach local files to message objects. Here's an example:
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready', () => {
console.log('I am ready!');
});
client.on('message', message => {
if (message.author.bot) return; // ignore bot messages
if (!message.content.startsWith('!')) return; // only respond to commands
const args = message.content.slice(1).split(' ');
const command = args.shift().toLowerCase();
if (command === 'image') {
const attachment = new Discord.MessageAttachment('path/to/local/image.png');
message.channel.send(attachment);
}
});
client.login('your_token_here');
In this example, the image
command sends the locally uploaded image path/to/local/image.png
as an attachment to the channel where the command was invoked.