Skip to content

Commit

Permalink
bypassed interaction timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Mast3rwaf1z committed Dec 13, 2023
1 parent bb0b7f1 commit f994914
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/src/main/java/wordcount/actions/Makepdf.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class Makepdf implements Action{
private boolean update = false;
private String outfile;
private Map<MessageChannel, Integer> percentages;
private Message message;
public boolean testExecute = false;
public boolean testRespond = false;

Expand All @@ -51,7 +52,7 @@ public Makepdf(Map<String, String> data, JDA jda) {
}
public Makepdf(Event event) {
this.event = event;
((SlashCommandInteractionEvent)event).deferReply(false).queue();
message = ((SlashCommandInteractionEvent)event).deferReply(false).complete().retrieveOriginal().complete();
target = ((SlashCommandInteractionEvent)event).getOption("target").getAsChannel();
debug = ((SlashCommandInteractionEvent)event).getOption("debug") == null ? false : ((SlashCommandInteractionEvent)event).getOption("debug").getAsBoolean();
update = ((SlashCommandInteractionEvent)event).getOption("updatecache") == null ? false : ((SlashCommandInteractionEvent)event).getOption("updatecache").getAsBoolean();
Expand Down Expand Up @@ -176,10 +177,10 @@ public void execute() {
execAndWait(installCommand);
if(!test){
if(new File(outfile).length() <= ((SlashCommandInteractionEvent)event).getGuild().getMaxFileSize()){
((SlashCommandInteractionEvent)event).getHook().editOriginal("Finished execution").setAttachments(AttachedFile.fromData(new File(outfile))).queue();
message.editMessage("Finished execution").setAttachments(AttachedFile.fromData(new File(outfile))).queue();
}
else{
((SlashCommandInteractionEvent)event).getChannel().retrieveMessageById(((SlashCommandInteractionEvent)event).getHook().retrieveOriginal().complete().getId()).complete().editMessage(String.format("Finished execution!\nFile size is too large for discord, here is a download link\n%s", App.debug ? "http://localhost:8123/"+outfile.split("/")[outfile.split("/").length-1] : "https://skademaskinen.win:11034/document/"+outfile.split("/")[outfile.split("/").length-1])).queue();
message.editMessage(String.format("Finished execution!\nFile size is too large for discord, here is a download link\n%s", App.debug ? "http://localhost:8123/"+outfile.split("/")[outfile.split("/").length-1] : "https://skademaskinen.win:11034/document/"+outfile.split("/")[outfile.split("/").length-1])).queue();
}
}
else{
Expand Down

0 comments on commit f994914

Please sign in to comment.