Thind
Thind
DIAdiscord.js - Imagine an app
Created by Thind on 9/13/2024 in #djs-questions
App didnt respond
async function handlePtMake(interaction) {
try {
const attachment = interaction.options.getAttachment('file');

if (!attachment || !attachment.name.endsWith('.xlsx')) {
await interaction.reply({ content: 'Please upload a valid Excel file.', ephemeral: true });
return;
}

await interaction.deferReply({ ephemeral: true });

// Fetch the attachment
const response = await fetch(attachment.url);
if (!response.ok) {
throw new Error('Failed to download the Excel file.');
}


async function handlePtMake(interaction) {
try {
const attachment = interaction.options.getAttachment('file');

if (!attachment || !attachment.name.endsWith('.xlsx')) {
await interaction.reply({ content: 'Please upload a valid Excel file.', ephemeral: true });
return;
}

await interaction.deferReply({ ephemeral: true });

// Fetch the attachment
const response = await fetch(attachment.url);
if (!response.ok) {
throw new Error('Failed to download the Excel file.');
}


7 replies