Skip to content

Update dependencies #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions bot/main/talium/coinsWatchtime/WatchtimeUpdateService.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package talium.coinsWatchtime;

import com.github.twitch4j.helix.domain.Chatter;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import talium.Out;
Expand All @@ -27,9 +27,8 @@ public class WatchtimeUpdateService {
private static final int COIN_PAYOUT_AMOUNT = 1;

static {
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("CHATTER_UPDATE_EXECUTOR").build();
ThreadFactory namedThreadFactory = new BasicThreadFactory.Builder().namingPattern("CHATTER_UPDATE_EXECUTOR").build();
CHATTER_UPDATE_SERVICE = Executors.newSingleThreadScheduledExecutor(namedThreadFactory);

}

public static void init(ChatterService chatterService) {
Expand Down
5 changes: 3 additions & 2 deletions bot/main/talium/tipeeeStream/TipeeeInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.socket.engineio.client.EngineIOException;
import org.apache.commons.lang.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.web.util.InvalidUrlException;
import org.springframework.web.util.UriComponentsBuilder;
import talium.Registrar;
import talium.TwitchBot;
Expand Down Expand Up @@ -148,12 +149,12 @@ static String getSocketUrlFromUrl(String socketInfoUrl) throws SocketInfoEndpoin
static @NotNull URI parseSocketInfoUrlResponse(String body, String apiKey) throws SocketInfoEndpointException {
try {
var datas = new JSONObject(body).getJSONObject("datas");
return UriComponentsBuilder.fromHttpUrl(datas.getString("host"))
return UriComponentsBuilder.fromUriString(datas.getString("host"))
.queryParam("access_token", apiKey)
.build().toUri();
} catch (JSONException e) {
throw new SocketInfoEndpointException("TipeeeStream socket info Url responded with unknown format!", e);
} catch (IllegalArgumentException e) {
} catch (InvalidUrlException | IllegalStateException e) {
throw new SocketInfoEndpointException("Returned Host ist not a valid URL!", e);
}
}
Expand Down
10 changes: 2 additions & 8 deletions bot/main/talium/twitchCommands/cooldown/CooldownService.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package talium.twitchCommands.cooldown;

import com.google.common.util.concurrent.ThreadFactoryBuilder;
import kotlin.Pair;
import org.checkerframework.dataflow.qual.Impure;
import org.checkerframework.dataflow.qual.Pure;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import talium.twitch4J.ChatMessage;
Expand Down Expand Up @@ -48,7 +46,7 @@ public class CooldownService {
private static final Logger log = LoggerFactory.getLogger(CooldownService.class);

static {
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("COOLDOWN_CLEANUP_EXECUTOR").build();
ThreadFactory namedThreadFactory = new BasicThreadFactory.Builder().namingPattern("COOLDOWN_CLEANUP_EXECUTOR").build();
cleanupService = Executors.newSingleThreadScheduledExecutor(namedThreadFactory);
cleanupService.scheduleAtFixedRate(CooldownService::cleanupCooldownUser, 0, 30, TimeUnit.MINUTES);
}
Expand All @@ -65,7 +63,6 @@ public class CooldownService {
* @apiNote <font color="red">This function increases the internal counter of this service!</font> Only call when you get a new Twitch Message from the specific user!
* @see CooldownService#getMessageUserIndex(TwitchUser)
*/
@Impure
public static int computeMessageUserIndex(TwitchUser user) {
var mapped = messageIndexes.getOrDefault(user.id(), 0);
messageIndexes.put(user.id(), mapped + 1);
Expand All @@ -77,7 +74,6 @@ public static int computeMessageUserIndex(TwitchUser user) {
* @param user user from with to get the messageIndex
* @return messageIndex for most recent message from user
*/
@Pure
public static int getMessageUserIndex(TwitchUser user) {
return messageIndexes.getOrDefault(user.id(), 0);
}
Expand All @@ -94,7 +90,6 @@ public static int getMessageUserIndex(TwitchUser user) {
* @apiNote <font color="red">This function increases the internal counter of this service!</font> Only call when you get a new Twitch chat Message!
* @see CooldownService#getMessageGlobalIndex()
*/
@Impure
public static int computeMessageGlobalIndex() {
globalMessageIndex++;
return globalMessageIndex;
Expand All @@ -104,7 +99,6 @@ public static int computeMessageGlobalIndex() {
* Get the messageGlobalIndex of the most recent message out of all users. Does not increase the underlying counter.
* @return the messageIndex for the most recent messsage for all users
*/
@Pure
public static int getMessageGlobalIndex() {
return globalMessageIndex;
}
Expand Down
90 changes: 44 additions & 46 deletions bot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.3</version>
<version>3.4.2</version>
</parent>
<groupId>de.orciument</groupId>
<artifactId>TaliumBot</artifactId>
Expand All @@ -17,96 +17,94 @@
</properties>

<dependencies>
<!-- Spring Boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<scope>runtime</scope>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<version>3.3.2</version>
<artifactId>spring-boot-starter-actuator</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>


<!-- Basic Libraries -->
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.10.2</version>
</dependency>
<dependency>
<groupId>com.github.twitch4j</groupId>
<artifactId>twitch4j</artifactId>
<version>1.21.0</version>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.11</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>6.0.11</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.3</version>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>io.socket</groupId>
<artifactId>socket.io-client</artifactId>
<version>2.1.0</version>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.11.0</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>3.1.3</version>
<groupId>com.github.twitch4j</groupId>
<artifactId>twitch4j</artifactId>
<version>1.21.0</version>
</dependency>
<dependency>
<groupId>io.socket</groupId>
<artifactId>socket.io-client</artifactId>
<version>2.1.1</version>
</dependency>

<!--Scope Test-->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
<version>6.1.3</version>
</dependency>
<dependency>
<groupId>net.datafaker</groupId>
<artifactId>datafaker</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.1.0-jre</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>3.2.2</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

Expand Down
1 change: 0 additions & 1 deletion bot/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ spring.datasource.url=jdbc:mariadb://${db_url}
spring.datasource.username=${db_user}
spring.datasource.password=${db_pass}
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MariaDBDialect
spring.jpa.properties.hibernate.globally_quoted_identifiers=true
spring.jpa.hibernate.ddl-auto=update
#Debug print (JPA-)SQL Queries
Expand Down
15 changes: 8 additions & 7 deletions bot/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<configuration debug="false">
<configuration debug="false" scan="true">
<!-- Stop output INFO at start -->
<statusListener class="ch.qos.logback.core.status.NopStatusListener"/>

Expand All @@ -13,25 +13,26 @@
</encoder>
</appender>

<logger name="logback" level="INFO"/>
<logger name="talium.inputs" level="WARN"/>
<logger name="talium.system" level="INFO"/>
<logger name="talium.coinsWatchtime" level="WARN"/>
<logger name="talium.ASCIIProgressbar" level="INFO"/>

<logger name="talium.TwitchBot" level="INFO" additivity="false">
<appender-ref ref="SYSTEM"/>
</logger>
<logger name="talium.system.inputSystem.HealthManager" level="INFO" additivity="false">
<logger name="talium.inputSystem.HealthManager" level="INFO" additivity="false">
<appender-ref ref="SYSTEM"/>
</logger>
<logger name="talium.system.StopWatch" level="INFO" additivity="false">
<logger name="talium.StopWatch" level="INFO" additivity="false">
<appender-ref ref="SYSTEM"/>
</logger>
<logger name="talium.system.coinsWatchtime" level="WARN"/>
<logger name="talium.system.ASCIIProgressbar" level="INFO"/>
<logger name="logback" level="INFO"/>
<logger name="org.springframework.security.web" level="INFO" additivity="false">
<appender-ref ref="STDOUT"/>
</logger>

<root name="STDOUT" level="WARN">
<root level="WARN">
<appender-ref ref="STDOUT"/>
</root>

Expand Down
2 changes: 1 addition & 1 deletion bot/test/talium/tipeeeStream/TipeeeInputTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void parseUrl_invalid_url() {
"message": "success",
"datas": {
"port": "443",
"host": "hts://sso-cf.tipeeestream.com"
"host": "https://..sso-cf.tipeeestream.com"
}
}""";
try {
Expand Down