Browse Source

Merge branch 'master' of yannicpunktdee.de:yannic/YoshiBot

pull/2/head
Paul Glaß 4 years ago
parent
commit
2987fef3e7
14 changed files with 185 additions and 92 deletions
  1. +3
    -3
      app/src/main/java/de/yannicpunktdee/yoshibot/audio/AudioLoadResultHandlerImpl.java
  2. +47
    -1
      app/src/main/java/de/yannicpunktdee/yoshibot/command/YoshiCommand.java
  3. +5
    -1
      app/src/main/java/de/yannicpunktdee/yoshibot/command/YoshiCommandDistributor.java
  4. +59
    -0
      app/src/main/java/de/yannicpunktdee/yoshibot/command/commands/BonkCommand.java
  5. +1
    -24
      app/src/main/java/de/yannicpunktdee/yoshibot/command/commands/PatCommand.java
  6. +1
    -23
      app/src/main/java/de/yannicpunktdee/yoshibot/command/commands/PlayCommand.java
  7. +1
    -1
      app/src/main/java/de/yannicpunktdee/yoshibot/command/commands/SayCommand.java
  8. +2
    -2
      app/src/main/java/de/yannicpunktdee/yoshibot/main/Main.java
  9. +2
    -2
      app/src/main/java/de/yannicpunktdee/yoshibot/main/YoshiBot.java
  10. +36
    -13
      app/src/main/java/de/yannicpunktdee/yoshibot/utils/Logger.java
  11. +23
    -16
      app/src/main/java/de/yannicpunktdee/yoshibot/utils/Resources.java
  12. +5
    -6
      app/src/main/java/de/yannicpunktdee/yoshibot/utils/SauceProvider.java
  13. BIN
      rsc/bonks/bonk1.png
  14. BIN
      rsc/bonks/bonk2.png

+ 3
- 3
app/src/main/java/de/yannicpunktdee/yoshibot/audio/AudioLoadResultHandlerImpl.java View File

@ -17,17 +17,17 @@ public class AudioLoadResultHandlerImpl implements AudioLoadResultHandler {
@Override @Override
public void playlistLoaded(AudioPlaylist playlist) { public void playlistLoaded(AudioPlaylist playlist) {
System.out.println("Kann aktuell noch keine Playlists abspielen");
Logger.logWarning("Aktuell kann noch keine Playlist abgespielt werden.");
} }
@Override @Override
public void noMatches() { public void noMatches() {
Logger.log("Nothing found", Logger.Type.INFO);
Logger.logError("Nothing found");
} }
@Override @Override
public void loadFailed(FriendlyException exception) { public void loadFailed(FriendlyException exception) {
System.out.println("Loading failed");
Logger.logError("Loading failed");
} }
} }

+ 47
- 1
app/src/main/java/de/yannicpunktdee/yoshibot/command/YoshiCommand.java View File

@ -1,7 +1,17 @@
package de.yannicpunktdee.yoshibot.command; package de.yannicpunktdee.yoshibot.command;
import de.yannicpunktdee.yoshibot.utils.Logger;
import de.yannicpunktdee.yoshibot.utils.Resources;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.Message.Attachment;
import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.MessageEmbed;
import java.io.File;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
/** /**
* Abstrakte Superklasse für alle Kommandos. * Abstrakte Superklasse für alle Kommandos.
* *
@ -48,5 +58,41 @@ public abstract class YoshiCommand {
protected final void sendMessage(MessageEmbed messageEmbed) { protected final void sendMessage(MessageEmbed messageEmbed) {
context.getEvent().getTextChannel().sendMessage(messageEmbed).queue(); context.getEvent().getTextChannel().sendMessage(messageEmbed).queue();
} }
protected File downloadAttachmentToFile(String directoryPath, String name){
if(directoryPath == null) directoryPath = Resources.getTempPath();
if(name == null) name = UUID.randomUUID().toString();
if(!(new File(directoryPath)).isDirectory()){
Logger.logError("Das Download-Verzeichnis wurde nicht gefunden.");
sendMessage("Der Anhang konnte nicht gedownloaded werden.");
return null;
}
List<Attachment> attachments = context.getEvent().getMessage().getAttachments();
if(attachments.size() == 0){
return null;
}
Attachment attachment = attachments.get(0);
File file = new File(directoryPath + name + "." + attachment.getFileExtension());
CompletableFuture<File> future = attachment.downloadToFile(file);
future.exceptionally(e -> {
sendMessage("Ein Anhang konnte nicht gedownloaded werden.");
return null;
});
try {
future.get();
} catch (InterruptedException | ExecutionException e) {
sendMessage("Ein Anhang konnte nicht gedownloaded werden.");
return null;
}
if(!file.exists()) {
sendMessage("Ein Anhang konnte nicht gedownloaded werden.");
return null;
}
return file;
}
} }

+ 5
- 1
app/src/main/java/de/yannicpunktdee/yoshibot/command/YoshiCommandDistributor.java View File

@ -59,6 +59,9 @@ public class YoshiCommandDistributor {
case PAT: case PAT:
command = new PatCommand(context); command = new PatCommand(context);
break; break;
case BONK:
command = new BonkCommand(context);
break;
case WIKIPEDIA: case WIKIPEDIA:
command = new WikipediaCommand(context); command = new WikipediaCommand(context);
break; break;
@ -108,7 +111,8 @@ public class YoshiCommandDistributor {
DELETE, DELETE,
SAUCE, SAUCE,
PAT, PAT,
WIKIPEDIA
WIKIPEDIA,
BONK
} }


+ 59
- 0
app/src/main/java/de/yannicpunktdee/yoshibot/command/commands/BonkCommand.java View File

@ -0,0 +1,59 @@
package de.yannicpunktdee.yoshibot.command.commands;
import de.yannicpunktdee.yoshibot.command.YoshiCommand;
import de.yannicpunktdee.yoshibot.command.YoshiCommandContext;
import de.yannicpunktdee.yoshibot.utils.GifSequenceWriter;
import de.yannicpunktdee.yoshibot.utils.Resources;
import javax.imageio.ImageIO;
import javax.imageio.stream.FileImageOutputStream;
import javax.imageio.stream.ImageOutputStream;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.UUID;
public class BonkCommand extends YoshiCommand {
public BonkCommand(YoshiCommandContext context) {
super(context);
}
@Override
public boolean execute() {
if(!super.execute()) return false;
File outFile = new File(Resources.getTempPath() + UUID.randomUUID().toString() + ".gif");
try {
BufferedImage inPicture = ImageIO.read(downloadAttachmentToFile(null, null));
BufferedImage bonk1Picture = ImageIO.read(new File(Resources.getBonkPngPath() + "bonk1.png"));
BufferedImage bonk2Picture = ImageIO.read(new File(Resources.getBonkPngPath() + "bonk2.png"));
BufferedImage frame1 = getOutFrame(bonk1Picture, inPicture, 615, 155, 185, 345);
ImageOutputStream output = new FileImageOutputStream(outFile);
GifSequenceWriter writer = new GifSequenceWriter(output, frame1.getType(), 100, true);
writer.writeToSequence(frame1);
writer.writeToSequence(getOutFrame(bonk2Picture, inPicture, 455, 155, 345, 345));
writer.close();
output.close();
} catch (IOException e) {
sendMessage("GIF konnte nicht erstellt werden.");
return false;
}
context.getEvent().getTextChannel().sendFile(outFile).queue();
return true;
}
private BufferedImage getOutFrame(BufferedImage bonkDogGraphics, BufferedImage personGraphics, int x, int y, int width, int height){
BufferedImage outFrame = new BufferedImage(800, 500, BufferedImage.TYPE_INT_RGB);
Graphics2D g = outFrame.createGraphics();
g.setColor(Color.black);
g.drawImage(personGraphics, x, y, width, height, null);
g.drawImage(bonkDogGraphics, 0, 0, 680, 412, null);
return outFrame;
}
}

+ 1
- 24
app/src/main/java/de/yannicpunktdee/yoshibot/command/commands/PatCommand.java View File

@ -27,34 +27,11 @@ public class PatCommand extends YoshiCommand {
@Override @Override
public boolean execute() { public boolean execute() {
if (!super.execute()) return false; if (!super.execute()) return false;
List<Message.Attachment> attachments = context.getEvent().getMessage().getAttachments();
if(attachments.size() != 1){
sendMessage("Um dieses Kommando auszuführen benötigt es EINE Bilddatei.");
return false;
}
Message.Attachment attachment = attachments.get(0);
String inPath =
Resources.getTempPath()
+ UUID.randomUUID().toString()
+ "." + attachment.getFileExtension();
File outFile = new File(Resources.getTempPath() + UUID.randomUUID().toString() + ".gif"); File outFile = new File(Resources.getTempPath() + UUID.randomUUID().toString() + ".gif");
CompletableFuture<File> future = attachment.downloadToFile(inPath);
future.exceptionally(e -> {
sendMessage("Der Anhang konnte nicht gedownloaded werden.");
return null;
});
try {
future.get();
} catch (InterruptedException | ExecutionException e) {
sendMessage("Die Bilddatei konnte nicht ordnungsgemäß erstellt werden.");
return false;
}
try { try {
BufferedImage inPicture= ImageIO.read(new File(inPath));
BufferedImage inPicture= ImageIO.read(downloadAttachmentToFile(null, null));
BufferedImage pat1Picture= ImageIO.read(new File(Resources.getPatPngPath() + "pat1.png")); BufferedImage pat1Picture= ImageIO.read(new File(Resources.getPatPngPath() + "pat1.png"));
BufferedImage pat2Picture= ImageIO.read(new File(Resources.getPatPngPath() + "pat2.png")); BufferedImage pat2Picture= ImageIO.read(new File(Resources.getPatPngPath() + "pat2.png"));
BufferedImage pat3Picture= ImageIO.read(new File(Resources.getPatPngPath() + "pat3.png")); BufferedImage pat3Picture= ImageIO.read(new File(Resources.getPatPngPath() + "pat3.png"));


+ 1
- 23
app/src/main/java/de/yannicpunktdee/yoshibot/command/commands/PlayCommand.java View File

@ -42,29 +42,7 @@ public class PlayCommand extends YoshiCommand {
YoshiBot yoshiBot = YoshiBot.getInstance(); YoshiBot yoshiBot = YoshiBot.getInstance();
if (context.containsArguments(new String[]{"add"})) { if (context.containsArguments(new String[]{"add"})) {
List<Message.Attachment> attachments = context.getEvent().getMessage().getAttachments();
if (attachments.size() != 1) {
sendMessage("Falsche Anzahl an Anhängen");
return false;
}
String path = Resources.getPathToAudioFile(context.getArgument("name"));
if ((new File(path)).exists()) {
sendMessage("Ein Soundeffekt mit diesem Namen existiert bereits.");
return false;
}
CompletableFuture<File> future = attachments.get(0).downloadToFile(path);
future.exceptionally(e -> {
sendMessage("Der Anhang konnte nicht gedownloaded werden.");
return null;
});
try {
future.get();
sendMessage("Sound erfolgreich hinzugef\u00fcgt.");
} catch (InterruptedException | ExecutionException e) {
sendMessage("Die Sounddatei konnte nicht ordnungsgemäß erstellt werden.");
return false;
}
downloadAttachmentToFile(Resources.getAudioPath(), context.getArgument("name"));
} else if (context.containsArguments(new String[]{"list"})) { } else if (context.containsArguments(new String[]{"list"})) {
File audioDirectory = new File(Resources.getAudioPath()); File audioDirectory = new File(Resources.getAudioPath());
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();


+ 1
- 1
app/src/main/java/de/yannicpunktdee/yoshibot/command/commands/SayCommand.java View File

@ -48,7 +48,7 @@ public class SayCommand extends YoshiCommand {
builder.append(line).append("\n"); builder.append(line).append("\n");
} }
if (builder.toString().length() > 0) { if (builder.toString().length() > 0) {
Logger.log(builder.toString(), Logger.Type.ERROR);
Logger.logError(builder.toString());
} }
if (resourceToDelete != null) if (resourceToDelete != null)
synchronized (resourceToDelete) { synchronized (resourceToDelete) {


+ 2
- 2
app/src/main/java/de/yannicpunktdee/yoshibot/main/Main.java View File

@ -20,11 +20,11 @@ public class Main {
YoshiBot yoshiBot = YoshiBot.getInstance(); YoshiBot yoshiBot = YoshiBot.getInstance();
if(!yoshiBot.init((args.length > 0)? args[0] : null)){ if(!yoshiBot.init((args.length > 0)? args[0] : null)){
Logger.log("Es ist ein Fehler beim Initialisieren der Ressourcen aufgetreten.", Logger.Type.ERROR);
Logger.logError("Es ist ein Fehler beim Initialisieren der Ressourcen aufgetreten.");
return; return;
} }
Logger.log("Ressourcen erfolgreich initialisiert. Starte Yoshi Bot ...", Logger.Type.INFO);
Logger.logInfo("Ressourcen erfolgreich initialisiert. Starte Yoshi Bot ...");
try { try {
yoshiBot.start(); yoshiBot.start();


+ 2
- 2
app/src/main/java/de/yannicpunktdee/yoshibot/main/YoshiBot.java View File

@ -92,7 +92,7 @@ public final class YoshiBot {
try { try {
jda.awaitReady(); jda.awaitReady();
} catch (InterruptedException e) { } catch (InterruptedException e) {
Logger.log("Konnte nicht auf jda warten. Thread unterbrochen.", Logger.Type.ERROR);
Logger.logError("Konnte nicht auf jda warten. Thread unterbrochen.");
return; return;
} }
@ -146,7 +146,7 @@ public final class YoshiBot {
List<String> text = Files.readAllLines(new File(Resources.getActivitiesPath()).toPath()); List<String> text = Files.readAllLines(new File(Resources.getActivitiesPath()).toPath());
String activity = text.get(yoshiBot.random.nextInt(text.size())); String activity = text.get(yoshiBot.random.nextInt(text.size()));
yoshiBot.jda.getPresence().setActivity(Activity.playing(activity)); yoshiBot.jda.getPresence().setActivity(Activity.playing(activity));
Logger.log("Setze Aktivität auf " + activity, Logger.Type.INFO);
Logger.logInfo("Setze Aktivität auf " + activity);
} }
} }

+ 36
- 13
app/src/main/java/de/yannicpunktdee/yoshibot/utils/Logger.java View File

@ -1,20 +1,43 @@
package de.yannicpunktdee.yoshibot.utils; package de.yannicpunktdee.yoshibot.utils;
public final class Logger { public final class Logger {
public enum Type {
INFO,
WARNING,
ERROR
private static final String ANSI_RESET = "\u001B[0m";
private static final String ANSI_GREEN = "\u001B[32m";
private static final String ANSI_YELLOW = "\u001B[33m";
private static final String ANSI_BLUE = "\u001B[34m";
public static void logDebug(String message){
System.out.println(String.format("%s[%tT: Yoshi::DEBUG] %s%s",
ANSI_GREEN,
System.currentTimeMillis(),
message,
ANSI_RESET));
} }
public static void log(String message, Type type) {
String text = String.format("[%tT: Yoshi::%s] %s",
System.currentTimeMillis(),
(type == null ? Type.INFO : type),
message);
System.out.println(text);
public static void logInfo(String message){
System.out.println(String.format("%s[%tT: Yoshi::INFO] %s%s",
ANSI_BLUE,
System.currentTimeMillis(),
message,
ANSI_RESET));
}
public static void logWarning(String message){
System.out.println(String.format("%s[%tT: Yoshi::WARNING] %s%s",
ANSI_YELLOW,
System.currentTimeMillis(),
message,
ANSI_RESET));
}
public static void logError(String message){
System.err.println(String.format("%s[%tT: Yoshi::ERROR] %s%s",
ANSI_YELLOW,
System.currentTimeMillis(),
message,
ANSI_RESET));
} }
} }

+ 23
- 16
app/src/main/java/de/yannicpunktdee/yoshibot/utils/Resources.java View File

@ -1,7 +1,6 @@
package de.yannicpunktdee.yoshibot.utils; package de.yannicpunktdee.yoshibot.utils;
import de.yannicpunktdee.yoshibot.main.YoshiBot; import de.yannicpunktdee.yoshibot.main.YoshiBot;
import de.yannicpunktdee.yoshibot.utils.Logger.Type;
import lombok.Getter; import lombok.Getter;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.json.JSONArray; import org.json.JSONArray;
@ -40,6 +39,8 @@ public final class Resources {
private static String patPngPath; private static String patPngPath;
@Getter @Getter
private static String imagePath; private static String imagePath;
@Getter
private static String bonkPngPath;
@Getter @Getter
private static String jda_builder_string; private static String jda_builder_string;
@ -78,15 +79,16 @@ public final class Resources {
if (isOk) isOk = initTagFilter(); if (isOk) isOk = initTagFilter();
if (isOk) isOk = initPatPngPath(); if (isOk) isOk = initPatPngPath();
if (isOk) isOk = initImages(); if (isOk) isOk = initImages();
if (isOk) isOk = initBonkPngPath();
if (isOk) Logger.log("Die Konfigurationen wurden erfolgreich geladen.", Type.INFO);
else Logger.log("Die Konfiguration konnte nicht geladen werden", Type.ERROR);
if (isOk) Logger.logInfo("Die Konfigurationen wurden erfolgreich geladen.");
else Logger.logError("Die Konfiguration konnte nicht geladen werden");
return isOk; return isOk;
} }
private static boolean initResources(String resourcePathArg) { private static boolean initResources(String resourcePathArg) {
Logger.log("Versuche Resource-Verzeichnis zu finden.", Type.INFO);
Logger.logInfo("Versuche Resource-Verzeichnis zu finden.");
resourcePath = (new File((resourcePathArg == null) ? "rsc" : resourcePathArg)).getAbsolutePath() resourcePath = (new File((resourcePathArg == null) ? "rsc" : resourcePathArg)).getAbsolutePath()
.replace('\\', '/') + "/"; .replace('\\', '/') + "/";
@ -118,7 +120,7 @@ public final class Resources {
} }
private static boolean initTemp() { private static boolean initTemp() {
Logger.log("Versuche Temp-Verzeichnis zu finden.", Type.INFO);
Logger.logInfo("Versuche Temp-Verzeichnis zu finden.");
String theoreticalTempPath = System.getProperty("java.io.tmpdir").replace('\\', '/') + "/yoshibot/"; String theoreticalTempPath = System.getProperty("java.io.tmpdir").replace('\\', '/') + "/yoshibot/";
@ -131,7 +133,7 @@ public final class Resources {
if (tempDir.mkdir()) { if (tempDir.mkdir()) {
return verifyExists(tempDir.getAbsolutePath(), File::isDirectory) != null; return verifyExists(tempDir.getAbsolutePath(), File::isDirectory) != null;
} else { } else {
Logger.log("Temp-Verzeichnis konnte nicht erstellt werden.", Type.ERROR);
Logger.logError("Temp-Verzeichnis konnte nicht erstellt werden.");
return false; return false;
} }
} }
@ -140,7 +142,7 @@ public final class Resources {
File tempDirFile = new File(tempPath); File tempDirFile = new File(tempPath);
if (!tempDirFile.isDirectory()) { if (!tempDirFile.isDirectory()) {
if (!new File(tempPath).mkdir()) { if (!new File(tempPath).mkdir()) {
Logger.log("TempPath konnte nicht erstellt werden", Type.ERROR);
Logger.logError("TempPath konnte nicht erstellt werden");
} }
} }
return tempPath + name + ".opus"; return tempPath + name + ".opus";
@ -167,7 +169,7 @@ public final class Resources {
return false; return false;
} }
jda_builder_string = Files.readAllLines(new File(resourcePath + "PrivateJdaBuilderString.txt").toPath()).get(0); jda_builder_string = Files.readAllLines(new File(resourcePath + "PrivateJdaBuilderString.txt").toPath()).get(0);
Logger.log("jda_builder_string erfolgreich geladen", Type.INFO);
Logger.logInfo("jda_builder_string erfolgreich geladen");
return true; return true;
} }
@ -175,20 +177,25 @@ public final class Resources {
patPngPath = verifyExists(resourcePath + "pats/", File::isDirectory); patPngPath = verifyExists(resourcePath + "pats/", File::isDirectory);
return patPngPath != null; return patPngPath != null;
} }
private static boolean initBonkPngPath() {
bonkPngPath = verifyExists(resourcePath + "bonks/", File::isDirectory);
return bonkPngPath != null;
}
private static boolean initGuildId() { private static boolean initGuildId() {
if (!propertiesFile.containsKey("guild_id")) { if (!propertiesFile.containsKey("guild_id")) {
Logger.log("Die Config.properties benötigt das Attribut guild_id.", Type.ERROR);
Logger.logError("Die Config.properties benötigt das Attribut guild_id.");
return false; return false;
} }
String raw = propertiesFile.getProperty("guild_id"); String raw = propertiesFile.getProperty("guild_id");
try { try {
guild_id = Long.parseLong(raw); guild_id = Long.parseLong(raw);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
Logger.log("Die angegebene guild_id ist keine Ganzzahl", Type.ERROR);
Logger.logError("Die angegebene guild_id ist keine Ganzzahl");
return false; return false;
} }
Logger.log("guild_id erfolgreich geladen", Type.INFO);
Logger.logInfo("guild_id erfolgreich geladen");
return true; return true;
} }
@ -257,7 +264,7 @@ public final class Resources {
return false; return false;
} }
Logger.log("tags_general_filter erfolgreich geladen", Type.INFO);
Logger.logInfo("tags_general_filter erfolgreich geladen");
return true; return true;
} }
@ -268,21 +275,21 @@ public final class Resources {
} }
if (new File(resourcePath + "image/").mkdir()) { if (new File(resourcePath + "image/").mkdir()) {
imagePath = verifyExists(resourcePath + "image/", File::isDirectory); imagePath = verifyExists(resourcePath + "image/", File::isDirectory);
Logger.log("Bildordner erzeugt", Type.INFO);
Logger.logInfo("Bildordner erzeugt");
return true; return true;
} else { } else {
Logger.log("Konnte Bildordner nicht erzeugen!", Type.ERROR);
Logger.logError("Konnte Bildordner nicht erzeugen!");
return false; return false;
} }
} }
private static String verifyExists(String filename, Function<File, Boolean> checkIsValidFile) { private static String verifyExists(String filename, Function<File, Boolean> checkIsValidFile) {
String[] split = filename.split("/"); String[] split = filename.split("/");
Logger.log(String.format("Versuche %s zu finden.", split[split.length - 1]), Type.INFO);
Logger.logInfo(String.format("Versuche %s zu finden.", split[split.length - 1]));
if (checkIsValidFile.apply(new File(filename))) { if (checkIsValidFile.apply(new File(filename))) {
return filename; return filename;
} else { } else {
Logger.log(String.format("%s konnte nicht gefunden werden", filename), Type.ERROR);
Logger.logError(String.format("%s konnte nicht gefunden werden", filename));
return null; return null;
} }
} }


+ 5
- 6
app/src/main/java/de/yannicpunktdee/yoshibot/utils/SauceProvider.java View File

@ -53,7 +53,7 @@ public class SauceProvider {
tags += "+" + String.join("+", Resources.getFilteredTags()); tags += "+" + String.join("+", Resources.getFilteredTags());
Random rand = YoshiBot.getInstance().getRandom(); Random rand = YoshiBot.getInstance().getRandom();
String url = BASE_URL + "posts?tags=" + String.join("+", tags); String url = BASE_URL + "posts?tags=" + String.join("+", tags);
Logger.log("Soße angefordert für tags " + tags, Logger.Type.INFO);
Logger.logInfo("Soße angefordert für tags " + tags);
JSONObject baseObj = getParsedSauceData(url); JSONObject baseObj = getParsedSauceData(url);
int amount = baseObj.getInt("count"); int amount = baseObj.getInt("count");
if (amount == 0) { if (amount == 0) {
@ -95,17 +95,16 @@ public class SauceProvider {
for (JSONObject post : postsInternal) { for (JSONObject post : postsInternal) {
List<TextChannel> channels = yoshiBot.jda.getTextChannelsByName(feed.getKey(), true); List<TextChannel> channels = yoshiBot.jda.getTextChannelsByName(feed.getKey(), true);
if (channels.size() == 0) { if (channels.size() == 0) {
Logger.log("Kein Kanal mit dem Namen " + feed.getKey() + "gefunden", Logger.Type.ERROR);
Logger.logError("Kein Kanal mit dem Namen " + feed.getKey() + "gefunden");
break; break;
} else if (!channels.get(0).isNSFW()) { } else if (!channels.get(0).isNSFW()) {
Logger.log("Kanal " + feed.getKey() + " ist nicht als NSFW markiert!", Logger.Type.ERROR);
Logger.logError("Kanal " + feed.getKey() + " ist nicht als NSFW markiert!");
break; break;
} }
channels.get(0).sendMessage(makeStringFromJson(post)).queue(); channels.get(0).sendMessage(makeStringFromJson(post)).queue();
} }
if (postsInternal.size() > 0) { if (postsInternal.size() > 0) {
Logger.log(String.format("Found %d posts for feed '%s'", postsInternal.size(), feed.getKey()),
Logger.Type.INFO);
Logger.logInfo(String.format("Found %d posts for feed '%s'", postsInternal.size(), feed.getKey()));
} }
} }
@ -125,7 +124,7 @@ public class SauceProvider {
this.isSauceInit = true; this.isSauceInit = true;
this.provideSauce(); this.provideSauce();
} else { } else {
Logger.log("Konnte keine Kanaäle finden für die Soße", Logger.Type.ERROR);
Logger.logError("Konnte keine Kanaäle finden für die Soße");
} }
} }
} }


BIN
rsc/bonks/bonk1.png View File

Before After
Width: 680  |  Height: 412  |  Size: 152 KiB

BIN
rsc/bonks/bonk2.png View File

Before After
Width: 680  |  Height: 412  |  Size: 146 KiB

Loading…
Cancel
Save