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.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-08-26 11:00:00 +0000
Seen: 11 times
Last updated: Jan 14 '22
How can a DateTime Zone be changed to another DateTime Zone?
How can we direct to a randomly selected entry from a list using Nginx?
How can I load a text file in gensim?
How to stop the for-loop when a specific condition is fulfilled?
How can CSS variables in Angular Material 15 be replaced?
How can you obtain several parameters using a single GET request?
How can double quotes be added to strings within an array?
"How can a Boolean variable be saved in SQFLite?"