Skip to content

Commit

Permalink
fixed screenshot uploader
Browse files Browse the repository at this point in the history
  • Loading branch information
ImToggle committed Apr 16, 2024
1 parent 17abf55 commit 905dca9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 99 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package club.sk1er.patcher.util.screenshot;

import cc.polyfrost.oneconfig.images.OneImage;
import cc.polyfrost.oneconfig.libs.universal.UChat;
import cc.polyfrost.oneconfig.libs.universal.wrappers.message.UTextComponent;
import cc.polyfrost.oneconfig.utils.Multithreading;
import cc.polyfrost.oneconfig.utils.Notifications;
import cc.polyfrost.oneconfig.utils.commands.annotations.Command;
import cc.polyfrost.oneconfig.utils.commands.annotations.Main;
import club.sk1er.patcher.Patcher;
import club.sk1er.patcher.config.PatcherConfig;
import club.sk1er.patcher.render.ScreenshotPreview;
import club.sk1er.patcher.tasks.UploadScreenshotTask;
import club.sk1er.patcher.util.chat.ChatUtilities;
import cc.polyfrost.oneconfig.libs.universal.ChatColor;
import cc.polyfrost.oneconfig.libs.universal.UDesktop;
Expand Down Expand Up @@ -232,7 +235,19 @@ public void handle() {
public static class UploadScreenshot {
@Main
public void handle() {
UploadScreenshotTask.INSTANCE.execute(screenshot);
Multithreading.runAsync(() -> {
ChatUtilities.sendNotification("Screenshot Manager", "Uploading screenshot...");
try {
String url = (new OneImage(screenshot)).uploadToImgur(true);
IChatComponent component = new UTextComponent(prefix + ChatColor.GREEN + "Screenshot was uploaded to " + url + ".");
component.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url));
UChat.chat(component);

} catch (IOException e) {
ChatUtilities.sendNotification("Screenshot Manager", "Failed to upload screenshot.");
}

});
}
}

Expand Down
10 changes: 0 additions & 10 deletions src/main/kotlin/club/sk1er/patcher/coroutines/MCDispatchers.kt

This file was deleted.

46 changes: 0 additions & 46 deletions src/main/kotlin/club/sk1er/patcher/imgur/Imgur.kt

This file was deleted.

41 changes: 0 additions & 41 deletions src/main/kotlin/club/sk1er/patcher/tasks/UploadScreenshotTask.kt

This file was deleted.

0 comments on commit 905dca9

Please sign in to comment.