mirror of
https://github.com/DreamExposure/DisCal-Discord-Bot.git
synced 2026-02-09 21:18:28 -06:00
Use d4j v3.0.1, add redis stores (not working yet).
This commit is contained in:
@@ -3,6 +3,9 @@ package org.dreamexposure.discal.client;
|
||||
import discord4j.core.DiscordClient;
|
||||
import discord4j.core.DiscordClientBuilder;
|
||||
import discord4j.core.event.domain.lifecycle.ReadyEvent;
|
||||
import discord4j.store.redis.RedisStoreService;
|
||||
import io.lettuce.core.RedisClient;
|
||||
import io.lettuce.core.RedisURI;
|
||||
import org.dreamexposure.discal.client.listeners.discal.CrossTalkEventListener;
|
||||
import org.dreamexposure.discal.client.listeners.discord.ReadyEventListener;
|
||||
import org.dreamexposure.discal.client.message.MessageManager;
|
||||
@@ -81,20 +84,21 @@ public class DisCalClient {
|
||||
*/
|
||||
private static DiscordClient createClient() {
|
||||
DiscordClientBuilder clientBuilder = new DiscordClientBuilder(BotSettings.TOKEN.get());
|
||||
//Handle shard count and index.
|
||||
//Handle shard count and index for multiple java instances
|
||||
clientBuilder.setShardIndex(Integer.valueOf(BotSettings.SHARD_INDEX.get()));
|
||||
clientBuilder.setShardCount(Integer.valueOf(BotSettings.SHARD_COUNT.get()));
|
||||
|
||||
/*
|
||||
//Redis info + store service
|
||||
RedisURI uri = RedisURI.Builder
|
||||
.redis(BotSettings.REDIS_HOSTNAME.get(), Integer.valueOf(BotSettings.REDIS_PORT.get()))
|
||||
.withPassword(BotSettings.REDIS_PASSWORD.get())
|
||||
.build();
|
||||
|
||||
RedisStoreService rss = new RedisStoreService(RedisClient.create(uri));
|
||||
clientBuilder.setStoreService(rss);
|
||||
*/
|
||||
//Redis info + store service for caching
|
||||
if (BotSettings.USE_REDIS_STORES.get().equalsIgnoreCase("true")) {
|
||||
RedisURI uri = RedisURI.Builder
|
||||
.redis(BotSettings.REDIS_HOSTNAME.get(), Integer.valueOf(BotSettings.REDIS_PORT.get()))
|
||||
.withPassword(BotSettings.REDIS_PASSWORD.get())
|
||||
.build();
|
||||
|
||||
RedisStoreService rss = new RedisStoreService(RedisClient.create(uri));
|
||||
clientBuilder.setStoreService(rss);
|
||||
}
|
||||
|
||||
return clientBuilder.build();
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
<configuration scan="true">
|
||||
<logger name="io.netty" level="INFO"/>
|
||||
<logger name="reactor" level="INFO"/>
|
||||
<logger name="proxy" level="info"/>
|
||||
<logger name="reactor.retry" level="DEBUG"/>
|
||||
<logger name="discord4j.core" level="DEBUG"/>
|
||||
<logger name="discord4j.gateway" level="INFO"/>
|
||||
<logger name="discord4j.gateway.client" level="DEBUG"/>
|
||||
<logger name="io.lettuce" level="INFO"/>
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
@@ -13,7 +15,7 @@
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -20,16 +20,14 @@
|
||||
<dependency>
|
||||
<groupId>com.discord4j</groupId>
|
||||
<artifactId>discord4j-core</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>${discord4j.version}</version>
|
||||
</dependency>
|
||||
<!--Discord4J Redis Stores-->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>com.discord4j</groupId>
|
||||
<artifactId>stores-redis</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>${discord4j.stores.version}</version>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- Allows you to log events from Discord4J -->
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
|
||||
@@ -19,7 +19,9 @@ public enum BotSettings {
|
||||
CROSSTALK_SERVER_PORT, CROSSTALK_SERVER_HOST,
|
||||
CROSSTALK_CLIENT_PORT, CROSSTALK_CLIENT_HOST,
|
||||
|
||||
REDIS_PASSWORD, REDIS_HOSTNAME, REDIS_PORT;
|
||||
REDIS_PASSWORD, REDIS_HOSTNAME, REDIS_PORT,
|
||||
|
||||
USE_REDIS_STORES;
|
||||
|
||||
private String val;
|
||||
|
||||
|
||||
3
pom.xml
3
pom.xml
@@ -18,6 +18,9 @@
|
||||
|
||||
<thymeleaf.version>3.0.9.RELEASE</thymeleaf.version>
|
||||
<thymeleaf-layout-dialect.version>2.2.1</thymeleaf-layout-dialect.version>
|
||||
|
||||
<discord4j.version>3.0.1</discord4j.version>
|
||||
<discord4j.stores.version>3.0.1</discord4j.stores.version>
|
||||
</properties>
|
||||
|
||||
<groupId>org.dreamexposure</groupId>
|
||||
|
||||
Reference in New Issue
Block a user