Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Enable guild caching #206

Closed
wants to merge 2 commits into from
Closed
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
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ dependencies {
implementation("net.sf.trove4j", "trove4j", "3.0.3")

// Http
implementation(platform("io.ktor:ktor-bom:1.5.3"))
implementation(platform("io.ktor:ktor-bom:1.6.0"))
implementation("io.ktor", "ktor-client")
implementation("io.ktor", "ktor-client-okhttp")
implementation("io.ktor", "ktor-client-serialization-jvm")
implementation("org.jetbrains.kotlinx", "kotlinx-serialization-json", "1.2.1")

// Config
implementation("com.github.uchuhimo.konf", "konf", "master-SNAPSHOT")
implementation("com.uchuhimo", "konf", "1.1.2")
implementation("com.fasterxml.jackson.module", "jackson-module-kotlin", "2.12.+")

// Autohelp
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
#
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 7 additions & 0 deletions src/main/kotlin/com/github/devcordde/devcordbot/Launcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import ch.qos.logback.classic.Level
import ch.qos.logback.classic.Logger
import com.github.devcordde.devcordbot.config.Config
import com.github.devcordde.devcordbot.constants.Constants
import dev.kord.cache.map.MapLikeCollection
import dev.kord.cache.map.internal.MapEntryCache
import dev.kord.core.Kord
import dev.kord.gateway.Intent
import dev.kord.gateway.Intents
Expand Down Expand Up @@ -76,6 +78,11 @@ suspend fun main(args: Array<String>) {
val kord = Kord(config.discord.token) {
httpClient = HttpClient(CIO)
intents = Intents.nonPrivileged + Intent.GuildMembers
cache {
guilds { cache, description ->
MapEntryCache(cache, description, MapLikeCollection.concurrentHashMap())
}
}
Comment on lines +81 to +85
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still won't have any effect since guild caching is a thing that is enabled by default

}
val guild = kord.getGuild(config.discord.guildId) ?: error("Could not find dev guild")

Expand Down