Files not getting attached

I am trying to add text files as attachments, but it seems not to be working. Might be something obvious I am missing. Code I am working with (It has the catch block and other items)
client.on('interactionCreate', async (interaction: Interaction) => {
try {
if (interaction.isChatInputCommand()) {
await interaction.reply( {
components: [new ContainerBuilder().addTextDisplayComponents(new TextDisplayBuilder().setContent("abc"))],
files: [new AttachmentBuilder(Buffer.from("test"), { name: 'test.txt' })],
flags: MessageFlags.IsComponentsV2
});
//return await handleCommands(interaction);
}
client.on('interactionCreate', async (interaction: Interaction) => {
try {
if (interaction.isChatInputCommand()) {
await interaction.reply( {
components: [new ContainerBuilder().addTextDisplayComponents(new TextDisplayBuilder().setContent("abc"))],
files: [new AttachmentBuilder(Buffer.from("test"), { name: 'test.txt' })],
flags: MessageFlags.IsComponentsV2
});
//return await handleCommands(interaction);
}
There are no errors and interaction reply is seen as container with text abc just with no attachment. Please help.
No description
4 Replies
d.js toolkit
d.js toolkit5mo ago
Kkkkk
KkkkkOP5mo ago
Thanks did not realise i missed this
No description
Kkkkk
KkkkkOP5mo ago
thanks a lot for the quick help Thanks makes sense, it worked
d.js toolkit
d.js toolkit5mo ago
The thread owner has marked this issue as solved.

Did you find this page helpful?