No tengo mucha experiencia en javascript y tengo un problema para mostrar mi imagen adjunta. cuando alguien escriba el bot n. ° 1 envíe una inserción con características y ¡quiero publicar la imagen también! No sé si lo formateé mal o si debo cargar la imagen primero. Entonces, la imagen es mi carpeta local en el mismo directorio que mi archivo index.js
¡Yo también tuve problemas con el color! ¡No logré modificarlo! No logré modificarlo me hubiera gustado poder cambiar el color del nombre título o descripción pero no se si es posible mis pruebas no fueron exitosas ¿Me podrían ayudar un poco por favor? Aquí está mi código. Gracias por adelantado.
const { token, prefix } = require('../config.json'); const Discord = require('discord.js'); const client = new Discord.Client(); // Listen to the Bot being ready client.once('ready', () => onClientReady()); function onClientReady() { // Listen to Messages in the channel client.on('message', (message) => onMessageReceived(message)); } // Upon a message being received, handle how we interact function onMessageReceived(message) { if(message.author.bot) return; if (message.content.toLowerCase().includes('#1')) message.channel.send({ embed: { color: 3447003, title: "SpaceShips #1 New_York", url: "http://google.com", description: "RANK: 74 / SCORE: 121", Thumbnail: (url="attachment://000793.jpg"), fields: [{ name: "__**POWER**__", value: "AG 0: **39**", "inline": true }, { name: "__**POWER**__", value: "EW: **76**", "inline": true }, { name: "__**AUTONOMY**__", value: "EY-W Nrg: **74**", "inline": true }, { name: "__**AUTONOMY**__", value: "BP 0 Nrg: **73**", "inline": true }, { name: "__**DISPLACEMENT**__", value: "LA: **79**", "inline": true }, { name: "__**DISPLACEMENT**__", value: "3D-V: **67**", "inline": true }, { name: "__**SPECIALS**__", value: "EM-W: **34**", "inline": true }, { name: "__**SPECIALS**__", value: "3D-W: **42**", "inline": true } ], } }); } client.login(token);Si está trabajando con python y solo quiere enviar una imagen, intente esto:
await channel.send(file=discord.File('my_image.png'))Simplemente puede agregar un valor de imagen al objeto incrustado que está enviando así:
message.channel.send({ embed: { color: 3447003, title: "SpaceShips #1 New_York", url: "http://google.com", description: "RANK: 74 / SCORE: 121", thumbnail: { url: "attachment://000793.jpg" }, } }); // Removed fields to clear up the clutter, you may add them like before!En lo que respecta al color, es un valor RGB, ¡puedes buscar en Google el valor del color que te gusta y reemplazarlo!
Si solo quieres enviar la imagen, supongo que aquí (Node.Js)
const path = require('path'); const Discord = require('discord.js'); let pic = path.resolve('test.jpg') // the picture, if you console.log it will send the path of the file for example mine /src/image/test.jpg message.channel.send(new Discord.MessageAttachment(pic))