Skip to content
← Back to Community
how to put make the discord bot put an image? Node.js
Profile icon
LukeArwolf

how to put make the discord bot put an image? Node.js

Voters
Profile icon
LukeArwolf
Comments
hotnewtop
Profile icon
Squirrel777

Add a folder called images, put an image in it, and add the following code:

client.on('message', msg => { if (msg.content.startsWith ('!image')) { msg.channel.send('An Image:', {files: ["./images/yourImage.png"]}); } });

Then type !image in your discord server and it will appear!

Profile icon
LukeArwolf

can you help me put an image in this code?

const Discord = require('discord.js');

module.exports.run = async (client, message, args) => {
message.channel.send('test');
console.log('test');
};

Profile icon
SixBeeps

Is this in an embed, or just a normal image?

Profile icon
LukeArwolf

@SixBeeps
normal image

Profile icon
SixBeeps

@LukeArwolf
Something like this:

channel.send({ files: ['https://link-to.some/image.png'] })
Profile icon
LukeArwolf

@SixBeeps
needs to be .png?

Profile icon
LukeArwolf

@SixBeeps
it didn't work

Profile icon
SixBeeps

@LukeArwolf
It should be any image that Discord supports (png/jpg)
Show me the code that doesn't work.

Profile icon
LukeArwolf

@SixBeeps
I want to put an image after the text "test"

const Discord = require('discord.js');

module.exports.run = async (client, message, args) => {
message.channel.send('test');
console.log('test');
};

Profile icon
SixBeeps

@LukeArwolf

const Discord = require('discord.js'); module.exports.run = async (client, message, args) => { message.channel.send('test', { files: ['https://link-to.some/image.png'] }); console.log('test'); };
Profile icon
LukeArwolf

@SixBeeps
THANK YOU VERY MUCH. helped a lot <3 <3 <3
now it worked <3 <3