AttachmentBuilder.base64 constructor
Create an attachment from a base64 string
await interaction.reply(
content: 'Hello World!',
attachments: [AttachmentBuilder.base64('BASE 64 ENCODED STRING', filename: 'hello.png', description: 'Use a file? Nah!']
);
You can integrate image in embeds :
await interaction.reply(
content: 'Hello World!',
attachments: [AttachmentBuilder.base64('BASE 64 ENCODED STRING', filename: 'hello.png', description: 'Use a file? Nah!'],
embeds: [EmbedBuilder(title: 'How are you?', thumbnail: Thumbnail(url: 'attachment://hello.png'))]
);
Implementation
factory AttachmentBuilder.base64(String content, {required String filename, String? description}) {
return AttachmentBuilder(base64Decode(content), filename: filename, description: description);
}