Why cant i use .addFile method in a privateChannel

38 Views Asked by At

I've been trying to learn JDA by making a ticket bot. I got everything working other that the transcripts because if the following error:

Cannot resolve method 'addFile' in 'MessageCreateAction'

Here is the code

String fileContent = readFileContent(outputFilePath);
                        User ticketUser = event.getJDA().getUserById(ticketUserId);
                        if (ticketUser != null) {
                            ticketUser.openPrivateChannel().queue(privateChannel -> {
                                privateChannel.sendMessage("Transcript for Ticket " + ticketNumber + ":").addFile(new java.io.File(outputFilePath), "Ticket_Export.html").queue(
                                        success -> {
                                            System.out.println("HTML file sent successfully to user: " + ticketUserId);
                                            // Additional ticket closing code (e.g., databaseManager.closeTicket(userId, ticketNumber)) can be placed here if needed.
                                        },
                                        error -> System.out.println("**Error**: Error sending transcript.")
                                );
                            });
                        } else {
                            System.out.println("**Error:** User not found for ID: " + ticketUserId);
                        }

I tried changing the code to multiple variations but none of them have worked

0

There are 0 best solutions below