Gary
Gary
DIAdiscord.js - Imagine an app
Created by Gary on 5/6/2025 in #djs-questions
MediaGalleryBuilder() error.
I've been encountering this error in which I pass the attachment://file.png in the MediaGalleryBuilder().media.url and send the AttachmentBuilder() in the files array, but it still outputs the error of it not encountering the file sent. As of now, the code is quite unpolished and really scraped on for "testing purposes", but it should work just fine; but, it doesn't.
if(message.content.startsWith('abrirTest')) {
const [command, title, minPlyrs, maxPlyrs, code, roleId] = message.content?.includes(' ')
? message.content?.split(' ')
: [null, null, null, null, null, null];

const startUpAttachment = new AttachmentBuilder(path.join(__dirname, '..', 'assets', 'votación.png'), { name: 'votación.png' });

const component = new StartUpEmbed()
.addAuthor(String(message.member.tag))
.setActualVotes(Number(maxPlyrs))
.setMinVotes(Number(minPlyrs))
.setColor(String('0x80a6d2'))
.setServerInfo(String(code))
.setTitle(String(title))
.setMentionableId(String(roleId))
.setAttachmentString('attachment://votación.png')

console.log(startUpAttachment);
return message.channel.send({
components: [ component.getComponent('attachment://votación.png') ],
flags: [
MessageFlags.IsComponentsV2,
MessageFlags.SuppressEmbeds
],
files: [ startUpAttachment ]
})
}
if(message.content.startsWith('abrirTest')) {
const [command, title, minPlyrs, maxPlyrs, code, roleId] = message.content?.includes(' ')
? message.content?.split(' ')
: [null, null, null, null, null, null];

const startUpAttachment = new AttachmentBuilder(path.join(__dirname, '..', 'assets', 'votación.png'), { name: 'votación.png' });

const component = new StartUpEmbed()
.addAuthor(String(message.member.tag))
.setActualVotes(Number(maxPlyrs))
.setMinVotes(Number(minPlyrs))
.setColor(String('0x80a6d2'))
.setServerInfo(String(code))
.setTitle(String(title))
.setMentionableId(String(roleId))
.setAttachmentString('attachment://votación.png')

console.log(startUpAttachment);
return message.channel.send({
components: [ component.getComponent('attachment://votación.png') ],
flags: [
MessageFlags.IsComponentsV2,
MessageFlags.SuppressEmbeds
],
files: [ startUpAttachment ]
})
}
22 replies