Skip to content

Commit

Permalink
Release 1.13.12 (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
rainbowdashlabs authored Apr 30, 2023
2 parents 8271860 + 98f1d72 commit ca14dd6
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 22 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "de.chojo"
version = "1.13.11"
version = "1.13.12"

repositories {
maven("https://eldonexus.de/repository/maven-public")
Expand Down Expand Up @@ -35,7 +35,7 @@ dependencies {
implementation("org.knowm.xchart", "xchart", "3.8.3")

// unit testing
testImplementation(platform("org.junit:junit-bom:5.9.2"))
testImplementation(platform("org.junit:junit-bom:5.9.3"))
testImplementation("org.junit.jupiter", "junit-jupiter")
testImplementation("org.knowm.xchart", "xchart", "3.8.3")
}
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ WORKDIR /app

COPY --from=build /build/libs/rep-bot-*-all.jar bot.jar

ENTRYPOINT ["java", "-Dbot.config=config/config.json", "-Dlog4j.configurationFile=config/log4j2.xml", "-jar" , "bot.jar"]
ENTRYPOINT ["java", "-Dbot.config=config/config.json", "-Dlog4j.configurationFile=config/log4j2.xml", "-Dcjda.localisation.error.name=false", "-jar" , "bot.jar"]
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 4 additions & 3 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

Expand Down Expand Up @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
rootProject.name = "rep-bot"

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version("0.4.0")
id("org.gradle.toolchains.foojay-resolver-convention") version("0.5.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;

import javax.validation.constraints.Null;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import de.chojo.jdautil.localization.util.Replacement;
import de.chojo.jdautil.parsing.Verifier;
import de.chojo.repbot.analyzer.MessageAnalyzer;
import de.chojo.repbot.dao.access.guild.settings.Settings;
import de.chojo.repbot.dao.provider.Guilds;
import de.chojo.repbot.util.Text;
import net.dv8tion.jda.api.entities.Guild;
Expand Down Expand Up @@ -86,12 +87,11 @@ public boolean scan() {
countScan();

if (message.getAuthor().isBot()) continue;
var settings = guilds.guild(guild).settings();
var result = messageAnalyzer.processMessage(pattern, message, settings, false,
settings.abuseProtection().maxMessageReputation());

var result = messageAnalyzer.processMessage(pattern, message, null, false, guilds.guild(guild).settings()
.abuseProtection()
.maxMessageReputation());

if(result.isEmpty()) continue;
if (result.isEmpty()) continue;

var matchResult = result.asMatch();

Expand All @@ -103,15 +103,15 @@ public boolean scan() {
switch (matchResult.thankType()) {
case FUZZY, MENTION -> {
if (reputation.user(resultReceiver.getUser())
.addOldReputation(donator != null && guild.isMember(donator) ? donator : null,
message, null, matchResult.thankType())) {
.addOldReputation(donator != null && guild.isMember(donator) ? donator : null,
message, null, matchResult.thankType())) {
hit();
}
}
case ANSWER -> {
if (reputation.user(resultReceiver.getUser())
.addOldReputation(donator != null && guild.isMember(donator) ? donator : null,
message, matchResult.asAnswer().referenceMessage(), matchResult.thankType())) {
.addOldReputation(donator != null && guild.isMember(donator) ? donator : null,
message, matchResult.asAnswer().referenceMessage(), matchResult.thankType())) {
hit();
}

Expand Down
16 changes: 11 additions & 5 deletions src/main/java/de/chojo/repbot/dao/access/Analyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ public void cleanup() {
builder().query("""
DELETE FROM analyzer_results WHERE analyzed < NOW() - ?::interval;
""")
.parameter(stmt -> stmt.setString("%d HOURS".formatted(configuration.cleanup().analyzerLogHours())))
.delete()
.send()
.whenComplete(Futures.whenComplete(res -> log.debug("Deleted {} entries from analyzer log", res.rows()),
err -> log.error(LogNotify.NOTIFY_ADMIN, "Could not cleanup analyzer log.", err)));
.parameter(stmt -> stmt.setString("%d HOURS".formatted(configuration.cleanup().analyzerLogHours())))
.delete()
.send()
.whenComplete(Futures.whenComplete(res -> log.debug("Deleted {} entries from analyzer log", res.rows()),
err -> log.error(LogNotify.NOTIFY_ADMIN, "Could not cleanup analyzer log.", err)));
builder().query("DELETE FROM reputation_results WHERE submitted < now() - ?::interval")
.parameter(stmt -> stmt.setString("%d HOURS".formatted(configuration.cleanup().analyzerLogHours())))
.delete()
.send()
.whenComplete(Futures.whenComplete(res -> log.debug("Deleted {} entries from reputation results", res.rows()),
err -> log.error(LogNotify.NOTIFY_ADMIN, "Could not cleanup reputation results.", err)));
}
}

0 comments on commit ca14dd6

Please sign in to comment.