From 956d2e7b7d128f9f1d7d086305bbca7435648d47 Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Thu, 10 Oct 2024 17:58:42 +0100 Subject: [PATCH] Update to KordEx v2 (#114) * Update to KordEx v2 * Configure the "about" command * Update Dockerfile * Switch to dev Gradle task in README * Mention Allium in dev bot about command * Update Kotlin and KordEx plugin * KordEx 2.2.0 updates, bump version * Fix patch notes extension * Add missing logback import * Quick build script cleanup/version pin * Update workflows --- .github/workflows/ci.yml | 8 +- .github/workflows/develop.yml | 8 +- .github/workflows/root.yml | 8 +- .idea/kotlinc.xml | 2 +- .idea/modules.xml | 1 - Dockerfile | 5 +- README.md | 2 +- build.gradle.kts | 21 ++- buildSrc/build.gradle.kts | 8 +- .../src/main/kotlin/cozy-module.gradle.kts | 2 +- gradle/libs.versions.toml | 5 +- module-ama/build.gradle.kts | 5 +- .../cozy/modules/ama/AmaExtension.kt | 40 ++-- .../community/cozy/modules/ama/_PkUtils.kt | 10 +- .../community/cozy/modules/ama/_Utils.kt | 20 +- .../cozy/modules/ama/data/AmaData.kt | 4 +- module-log-parser/build.gradle.kts | 5 +- .../cozy/modules/logs/LogParserExtension.kt | 16 +- .../community/cozy/modules/logs/Utils.kt | 8 +- .../modules/logs/config/LogParserConfig.kt | 2 +- .../logs/config/SimpleLogParserConfig.kt | 2 +- .../logs/events/DefaultEventHandler.kt | 2 +- .../modules/logs/events/PKEventHandler.kt | 4 +- .../logs/parsers/launchers/TechnicParser.kt | 2 +- .../logs/parsers/quilt/QuiltModsParser.kt | 2 +- .../logs/processors/PlayerIPProcessor.kt | 2 +- .../logs/processors/UnknownModProcessor.kt | 2 +- .../cozy/modules/logs/types/LogProcessor.kt | 4 +- .../cozy/modules/logs/types/LogRetriever.kt | 4 +- module-moderation/build.gradle.kts | 13 +- .../modules/moderation/ModerationExtension.kt | 34 ++-- .../modules/moderation/ModerationPlugin.kt | 17 +- .../cozy/modules/moderation/_Utils.kt | 6 +- .../moderation/config/ModerationConfig.kt | 2 +- .../config/SimpleModerationConfig.kt | 2 +- module-role-sync/build.gradle.kts | 10 +- .../modules/rolesync/RoleSyncExtension.kt | 10 +- .../cozy/modules/rolesync/RoleSyncPlugin.kt | 17 +- .../community/cozy/modules/rolesync/_Utils.kt | 8 +- .../modules/rolesync/config/RoleSyncConfig.kt | 2 +- .../rolesync/config/SimpleRoleSyncConfig.kt | 2 +- src/main/kotlin/org/quiltmc/community/App.kt | 61 ++++-- .../quiltmc/community/DiscordLogAppender.kt | 6 +- .../kotlin/org/quiltmc/community/_Checks.kt | 8 +- .../org/quiltmc/community/_Constants.kt | 10 +- .../kotlin/org/quiltmc/community/_Utils.kt | 74 ++++++-- .../quiltmc/community/database/Migrations.kt | 2 +- .../org/quiltmc/community/database/_Utils.kt | 2 +- .../collections/AmaConfigCollection.kt | 4 +- .../database/collections/FilterCollection.kt | 2 +- .../collections/GlobalSettingsCollection.kt | 2 +- .../collections/LinkedMessagesCollection.kt | 2 +- .../database/collections/MetaCollection.kt | 2 +- .../collections/OwnedThreadCollection.kt | 2 +- .../collections/ServerSettingsCollection.kt | 2 +- .../database/collections/TagsCollection.kt | 6 +- .../collections/UserFlagsCollection.kt | 2 +- .../collections/WelcomeChannelCollection.kt | 4 +- .../database/entities/AdaptedData.kt | 2 +- .../database/entities/GlobalSettings.kt | 4 +- .../database/entities/LinkedMessages.kt | 2 +- .../database/entities/ServerSettings.kt | 4 +- .../community/database/entities/TagEntity.kt | 2 +- .../community/database/entities/UserFlags.kt | 2 +- .../database/enums/QuiltServerType.kt | 2 +- .../database/storage/MongoDBDataAdapter.kt | 8 +- .../collab/extensions/BanRelayExtension.kt | 2 +- .../extensions/CollabSettingsExtension.kt | 2 +- .../collab/extensions/LookupExtension.kt | 18 +- .../modes/quilt/extensions/ForumExtension.kt | 45 +++-- .../quilt/extensions/ShowcaseExtension.kt | 38 ++-- .../modes/quilt/extensions/SyncExtension.kt | 20 +- .../quilt/extensions/UtilityExtension.kt | 46 ++--- .../extensions/filtering/FilterAction.kt | 2 +- .../extensions/filtering/FilterExtension.kt | 34 ++-- .../quilt/extensions/filtering/MatchTarget.kt | 2 +- .../quilt/extensions/filtering/MatchType.kt | 2 +- .../extensions/github/GithubExtension.kt | 22 +-- .../messagelog/MessageLogExtension.kt | 10 +- .../minecraft/MinecraftExtension.kt | 176 +++++++++++++++--- .../ModHostingVerificationExtension.kt | 16 +- .../extensions/settings/SettingsExtension.kt | 22 +-- .../extensions/storage/BannedReactions.kt | 2 +- src/main/resources/logback.groovy | 3 +- src/main/resources/logbackCompiler.groovy | 2 +- 85 files changed, 608 insertions(+), 400 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b63888ee..119e15e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up Java uses: actions/setup-java@v1 @@ -30,21 +30,21 @@ jobs: arguments: build - name: Upload artifacts (Main JAR) - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Main JAR path: build/libs/*-all.jar - name: Upload artifacts (JARs) - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: JARs path: build/libs/*.jar - name: Upload artifacts (Module JARs) - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Module JARs diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index ec7ac137..3b3650d9 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up Java uses: actions/setup-java@v1 @@ -27,21 +27,21 @@ jobs: arguments: build - name: Upload artifacts (Main JAR) - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Main JAR path: build/libs/*-all.jar - name: Upload artifacts (JARs) - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: JARs path: build/libs/*.jar - name: Upload artifacts (Module JARs) - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Module JARs diff --git a/.github/workflows/root.yml b/.github/workflows/root.yml index 27207990..3a554287 100644 --- a/.github/workflows/root.yml +++ b/.github/workflows/root.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Set up Java uses: actions/setup-java@v1 @@ -28,21 +28,21 @@ jobs: arguments: build - name: Upload artifacts (Main JAR) - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Main JAR path: build/libs/*-all.jar - name: Upload artifacts (JARs) - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: JARs path: build/libs/*.jar - name: Upload artifacts (Module JARs) - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: Module JARs diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index 996b1512..d4b7accb 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 128cf299..21ae45d6 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -4,7 +4,6 @@ - diff --git a/Dockerfile b/Dockerfile index 8b7be2dd..f70c9d6a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,12 @@ FROM openjdk:17-jdk-slim COPY build/libs/CozyDiscord-*-all.jar /usr/local/lib/CozyDiscord.jar RUN mkdir /bot +RUN mkdir /bot/data RUN mkdir /bot/plugins -RUN mkdir /data WORKDIR /bot +VOLUME /bot/data +VOLUME /bot/plugins + ENTRYPOINT ["java", "-Xms2G", "-Xmx2G", "-jar", "/usr/local/lib/CozyDiscord.jar"] diff --git a/README.md b/README.md index 839d1d52..697b6236 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ ENVIRONMENT=dev * `GITHUB_TOKEN`: GitHub auth token, for the GitHub project management commands -Once you've filled out your `.env` file, you can use the `run` gradle task to launch the bot. If this is your first +Once you've filled out your `.env` file, you can use the `dev` gradle task to launch the bot. If this is your first run, you'll want to start with the `quilt` mode as this is the mode that runs the database migrations. After that, feel free to set up and test whichever mode you need to work with. diff --git a/build.gradle.kts b/build.gradle.kts index 7bd2e96c..c92ac8c1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ import com.expediagroup.graphql.plugin.gradle.config.GraphQLSerializer +import dev.kordex.gradle.plugins.kordex.DataCollection /* * This Source Code Form is subject to the terms of the Mozilla Public @@ -52,17 +53,21 @@ dependencies { } kordEx { + version = "2.2.1-SNAPSHOT" + bot { + dataCollection(DataCollection.Minimal) + mainClass = "org.quiltmc.community.AppKt" } - module("annotations") - module("extra-mappings") - module("extra-phishing") - module("extra-pluralkit") - module("extra-tags") - module("extra-welcome") - module("unsafe") + module("dev-unsafe") + + module("func-phishing") + module("func-tags") + module("func-welcome") + + module("pluralkit") } graphql { @@ -76,7 +81,7 @@ graphql { gitHooks { setHooks( - mapOf("pre-commit" to "updateLicense detekt") + mapOf("pre-commit" to "applyLicenses detekt") ) } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index a9800e4f..148257d3 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -17,14 +17,14 @@ dependencies { implementation(gradleApi()) implementation(localGroovy()) - implementation(kotlin("gradle-plugin", version = "2.0.20-Beta1")) - implementation(kotlin("serialization", version = "2.0.20-Beta1")) + implementation(kotlin("gradle-plugin", version = "2.0.20")) + implementation(kotlin("serialization", version = "2.0.20")) implementation("com.github.jakemarsden", "git-hooks-gradle-plugin", "0.0.2") implementation("com.expediagroup.graphql", "com.expediagroup.graphql.gradle.plugin", "7.1.4") implementation("com.github.johnrengelman.shadow", "com.github.johnrengelman.shadow.gradle.plugin", "8.1.1") - implementation("com.google.devtools.ksp", "com.google.devtools.ksp.gradle.plugin", "2.0.20-Beta1-1.0.22") - implementation("dev.kordex.gradle.plugins", "kordex", "1.1.3") + implementation("com.google.devtools.ksp", "com.google.devtools.ksp.gradle.plugin", "2.0.20-1.0.24") + implementation("dev.kordex.gradle.plugins", "kordex", "1.4.1") implementation("dev.yumi", "yumi-gradle-licenser", "1.2.0") implementation("io.gitlab.arturbosch.detekt", "detekt-gradle-plugin", "1.23.6") } diff --git a/buildSrc/src/main/kotlin/cozy-module.gradle.kts b/buildSrc/src/main/kotlin/cozy-module.gradle.kts index 60df1fce..a276835a 100644 --- a/buildSrc/src/main/kotlin/cozy-module.gradle.kts +++ b/buildSrc/src/main/kotlin/cozy-module.gradle.kts @@ -16,7 +16,7 @@ plugins { } group = "org.quiltmc.community" -version = "1.0.1-SNAPSHOT" +version = "1.1.0-SNAPSHOT" repositories { maven { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 81a6f0d7..9e748e1e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] detekt = "1.23.6" -kotlin = "2.0.20-Beta1" +kotlin = "2.0.20" graphql = "7.1.4" autolink = "0.11.0" @@ -19,7 +19,6 @@ kx-ser = "1.7.1" logback = "1.5.6" logback-groovy = "1.14.5" logging = "7.0.0" -moshi = "1.15.1" rgxgen = "2.0" semver = "2.0.0" @@ -49,7 +48,5 @@ kx-ser = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version. logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } logback-groovy = { module = "io.github.virtualdogbert:logback-groovy-config", version.ref = "logback-groovy" } logging = { module = "io.github.oshai:kotlin-logging", version.ref = "logging" } -moshi-adapters = { module = "com.squareup.moshi:moshi-adapters", version.ref = "moshi" } -moshi-kotlin = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "moshi" } rgxgen = { module = "com.github.curious-odd-man:rgxgen", version.ref = "rgxgen" } semver = { module = "io.github.z4kn4fein:semver", version.ref = "semver" } diff --git a/module-ama/build.gradle.kts b/module-ama/build.gradle.kts index 1ea0d550..2efa08a2 100644 --- a/module-ama/build.gradle.kts +++ b/module-ama/build.gradle.kts @@ -15,7 +15,6 @@ dependencies { } kordEx { - module("annotations") - module("extra-pluralkit") - module("unsafe") + module("pluralkit") + module("dev-unsafe") } diff --git a/module-ama/src/main/kotlin/org/quiltmc/community/cozy/modules/ama/AmaExtension.kt b/module-ama/src/main/kotlin/org/quiltmc/community/cozy/modules/ama/AmaExtension.kt index fc13c0f2..6f8e6af1 100644 --- a/module-ama/src/main/kotlin/org/quiltmc/community/cozy/modules/ama/AmaExtension.kt +++ b/module-ama/src/main/kotlin/org/quiltmc/community/cozy/modules/ama/AmaExtension.kt @@ -6,26 +6,6 @@ package org.quiltmc.community.cozy.modules.ama -import com.kotlindiscord.kord.extensions.checks.anyGuild -import com.kotlindiscord.kord.extensions.checks.guildFor -import com.kotlindiscord.kord.extensions.commands.Arguments -import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand -import com.kotlindiscord.kord.extensions.commands.converters.impl.channel -import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalChannel -import com.kotlindiscord.kord.extensions.components.ComponentRegistry -import com.kotlindiscord.kord.extensions.components.components -import com.kotlindiscord.kord.extensions.components.ephemeralButton -import com.kotlindiscord.kord.extensions.components.forms.ModalForm -import com.kotlindiscord.kord.extensions.components.forms.widgets.LineTextWidget -import com.kotlindiscord.kord.extensions.components.forms.widgets.ParagraphTextWidget -import com.kotlindiscord.kord.extensions.extensions.Extension -import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand -import com.kotlindiscord.kord.extensions.extensions.event -import com.kotlindiscord.kord.extensions.modules.unsafe.annotations.UnsafeAPI -import com.kotlindiscord.kord.extensions.modules.unsafe.extensions.unsafeSlashCommand -import com.kotlindiscord.kord.extensions.modules.unsafe.types.InitialSlashCommandResponse -import com.kotlindiscord.kord.extensions.modules.unsafe.types.ackEphemeral -import com.kotlindiscord.kord.extensions.modules.unsafe.types.respondEphemeral import dev.kord.common.entity.ButtonStyle import dev.kord.common.entity.ChannelType import dev.kord.common.entity.Permission @@ -47,6 +27,24 @@ import dev.kord.core.entity.channel.GuildMessageChannel import dev.kord.core.entity.channel.TopGuildChannel import dev.kord.core.event.interaction.GuildButtonInteractionCreateEvent import dev.kord.rest.builder.message.embed +import dev.kordex.core.checks.anyGuild +import dev.kordex.core.checks.guildFor +import dev.kordex.core.commands.Arguments +import dev.kordex.core.commands.application.slash.ephemeralSubCommand +import dev.kordex.core.commands.converters.impl.channel +import dev.kordex.core.commands.converters.impl.optionalChannel +import dev.kordex.core.components.ComponentRegistry +import dev.kordex.core.components.components +import dev.kordex.core.components.ephemeralButton +import dev.kordex.core.components.forms.ModalForm +import dev.kordex.core.components.forms.widgets.LineTextWidget +import dev.kordex.core.components.forms.widgets.ParagraphTextWidget +import dev.kordex.core.extensions.Extension +import dev.kordex.core.extensions.ephemeralSlashCommand +import dev.kordex.core.extensions.event +import dev.kordex.modules.dev.unsafe.annotations.UnsafeAPI +import dev.kordex.modules.dev.unsafe.commands.slash.InitialSlashCommandResponse +import dev.kordex.modules.dev.unsafe.extensions.unsafeSlashCommand import org.koin.core.component.inject import org.quiltmc.community.cozy.modules.ama.data.AmaConfig import org.quiltmc.community.cozy.modules.ama.data.AmaData @@ -435,6 +433,7 @@ public class AmaExtension : Extension() { name = "answer-queue-channel" description = "The channel for asked questions to queue up in before response" requiredChannelTypes = mutableSetOf(ChannelType.GuildText) + validate { val checkResult = value.checkPermission(Permissions(Permission.ViewChannel, Permission.SendMessages)) failIf(checkResult == false, "The bot cannot see this channel") @@ -446,6 +445,7 @@ public class AmaExtension : Extension() { name = "live-chat-channel" description = "The channel questions will be sent to when answered by staff" requiredChannelTypes = mutableSetOf(ChannelType.GuildText) + validate { val checkResult = value.checkPermission(Permissions(Permission.ViewChannel, Permission.SendMessages)) failIf(checkResult == false, "The bot cannot see this channel") diff --git a/module-ama/src/main/kotlin/org/quiltmc/community/cozy/modules/ama/_PkUtils.kt b/module-ama/src/main/kotlin/org/quiltmc/community/cozy/modules/ama/_PkUtils.kt index 334cb48b..dc044ea9 100644 --- a/module-ama/src/main/kotlin/org/quiltmc/community/cozy/modules/ama/_PkUtils.kt +++ b/module-ama/src/main/kotlin/org/quiltmc/community/cozy/modules/ama/_PkUtils.kt @@ -6,14 +6,14 @@ package org.quiltmc.community.cozy.modules.ama -import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.api.PKMemberPrivacy -import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.api.PKProxyTag -import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.api.PKSystem -import com.kotlindiscord.kord.extensions.utils.envOrNull -import com.kotlindiscord.kord.extensions.utils.getKoin import dev.kord.common.Color import dev.kord.common.entity.optional.Optional import dev.kord.core.behavior.UserBehavior +import dev.kordex.core.utils.envOrNull +import dev.kordex.core.utils.getKoin +import dev.kordex.modules.pluralkit.api.PKMemberPrivacy +import dev.kordex.modules.pluralkit.api.PKProxyTag +import dev.kordex.modules.pluralkit.api.PKSystem import io.ktor.client.* import io.ktor.client.call.* import io.ktor.client.plugins.contentnegotiation.* diff --git a/module-ama/src/main/kotlin/org/quiltmc/community/cozy/modules/ama/_Utils.kt b/module-ama/src/main/kotlin/org/quiltmc/community/cozy/modules/ama/_Utils.kt index c06d6899..dcd2666c 100644 --- a/module-ama/src/main/kotlin/org/quiltmc/community/cozy/modules/ama/_Utils.kt +++ b/module-ama/src/main/kotlin/org/quiltmc/community/cozy/modules/ama/_Utils.kt @@ -6,15 +6,6 @@ package org.quiltmc.community.cozy.modules.ama -import com.kotlindiscord.kord.extensions.DISCORD_BLURPLE -import com.kotlindiscord.kord.extensions.DISCORD_GREEN -import com.kotlindiscord.kord.extensions.DISCORD_RED -import com.kotlindiscord.kord.extensions.DISCORD_YELLOW -import com.kotlindiscord.kord.extensions.builders.ExtensibleBotBuilder -import com.kotlindiscord.kord.extensions.components.ComponentContainer -import com.kotlindiscord.kord.extensions.components.components -import com.kotlindiscord.kord.extensions.components.ephemeralButton -import com.kotlindiscord.kord.extensions.utils.loadModule import dev.kord.common.Color import dev.kord.common.entity.ButtonStyle import dev.kord.common.entity.Snowflake @@ -26,6 +17,15 @@ import dev.kord.core.entity.User import dev.kord.core.entity.channel.GuildMessageChannel import dev.kord.rest.builder.message.EmbedBuilder import dev.kord.rest.builder.message.embed +import dev.kordex.core.DISCORD_BLURPLE +import dev.kordex.core.DISCORD_GREEN +import dev.kordex.core.DISCORD_RED +import dev.kordex.core.DISCORD_YELLOW +import dev.kordex.core.builders.ExtensionsBuilder +import dev.kordex.core.components.ComponentContainer +import dev.kordex.core.components.components +import dev.kordex.core.components.ephemeralButton +import dev.kordex.core.utils.loadModule import kotlinx.serialization.KSerializer import kotlinx.serialization.descriptors.PrimitiveKind import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor @@ -36,7 +36,7 @@ import org.koin.dsl.bind import org.quiltmc.community.cozy.modules.ama.data.AmaData import org.quiltmc.community.cozy.modules.ama.enums.QuestionStatusFlag -public fun ExtensibleBotBuilder.ExtensionsBuilder.extAma(data: AmaData) { +public fun ExtensionsBuilder.extAma(data: AmaData) { loadModule { single { data } bind AmaData::class } add(::AmaExtension) diff --git a/module-ama/src/main/kotlin/org/quiltmc/community/cozy/modules/ama/data/AmaData.kt b/module-ama/src/main/kotlin/org/quiltmc/community/cozy/modules/ama/data/AmaData.kt index 4df4c234..a9d37c68 100644 --- a/module-ama/src/main/kotlin/org/quiltmc/community/cozy/modules/ama/data/AmaData.kt +++ b/module-ama/src/main/kotlin/org/quiltmc/community/cozy/modules/ama/data/AmaData.kt @@ -6,10 +6,10 @@ package org.quiltmc.community.cozy.modules.ama.data -import com.kotlindiscord.kord.extensions.checks.hasPermission -import com.kotlindiscord.kord.extensions.checks.types.CheckContextWithCache import dev.kord.common.entity.Permission import dev.kord.common.entity.Snowflake +import dev.kordex.core.checks.hasPermission +import dev.kordex.core.checks.types.CheckContextWithCache public interface AmaData { public suspend fun getConfig(guildId: Snowflake): AmaConfig? diff --git a/module-log-parser/build.gradle.kts b/module-log-parser/build.gradle.kts index a6c30d78..3c56ed97 100644 --- a/module-log-parser/build.gradle.kts +++ b/module-log-parser/build.gradle.kts @@ -28,7 +28,6 @@ dependencies { } kordEx { - module("annotations") - module("extra-pluralkit") - module("unsafe") + module("pluralkit") + module("dev-unsafe") } diff --git a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/LogParserExtension.kt b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/LogParserExtension.kt index 7859eed2..e43477be 100644 --- a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/LogParserExtension.kt +++ b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/LogParserExtension.kt @@ -9,18 +9,18 @@ package org.quiltmc.community.cozy.modules.logs import com.charleskorn.kaml.Yaml -import com.kotlindiscord.kord.extensions.DISCORD_GREEN -import com.kotlindiscord.kord.extensions.DISCORD_RED -import com.kotlindiscord.kord.extensions.DISCORD_YELLOW -import com.kotlindiscord.kord.extensions.extensions.Extension -import com.kotlindiscord.kord.extensions.utils.capitalizeWords -import com.kotlindiscord.kord.extensions.utils.envOrNull -import com.kotlindiscord.kord.extensions.utils.respond -import com.kotlindiscord.kord.extensions.utils.scheduling.Scheduler import dev.kord.core.entity.Message import dev.kord.core.event.Event import dev.kord.rest.builder.message.create.MessageCreateBuilder import dev.kord.rest.builder.message.embed +import dev.kordex.core.DISCORD_GREEN +import dev.kordex.core.DISCORD_RED +import dev.kordex.core.DISCORD_YELLOW +import dev.kordex.core.extensions.Extension +import dev.kordex.core.utils.capitalizeWords +import dev.kordex.core.utils.envOrNull +import dev.kordex.core.utils.respond +import dev.kordex.core.utils.scheduling.Scheduler import io.github.oshai.kotlinlogging.KLogger import io.github.oshai.kotlinlogging.KotlinLogging import io.ktor.client.* diff --git a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/Utils.kt b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/Utils.kt index 1925391f..80c0308a 100644 --- a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/Utils.kt +++ b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/Utils.kt @@ -6,9 +6,9 @@ package org.quiltmc.community.cozy.modules.logs -import com.kotlindiscord.kord.extensions.builders.ExtensibleBotBuilder -import com.kotlindiscord.kord.extensions.utils.loadModule import com.unascribed.flexver.FlexVerComparator +import dev.kordex.core.builders.ExtensionsBuilder +import dev.kordex.core.utils.loadModule import org.koin.dsl.bind import org.nibor.autolink.LinkExtractor import org.nibor.autolink.LinkType @@ -17,7 +17,7 @@ import org.quiltmc.community.cozy.modules.logs.config.SimpleLogParserConfig import java.net.URI import java.net.URL -public inline fun ExtensibleBotBuilder.ExtensionsBuilder.extLogParser( +public inline fun ExtensionsBuilder.extLogParser( builder: (SimpleLogParserConfig.Builder).() -> Unit ) { val config = SimpleLogParserConfig(builder) @@ -27,7 +27,7 @@ public inline fun ExtensibleBotBuilder.ExtensionsBuilder.extLogParser( add(::LogParserExtension) } -public fun ExtensibleBotBuilder.ExtensionsBuilder.extLogParser(config: LogParserConfig) { +public fun ExtensionsBuilder.extLogParser(config: LogParserConfig) { loadModule { single { config } bind LogParserConfig::class } add(::LogParserExtension) diff --git a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/config/LogParserConfig.kt b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/config/LogParserConfig.kt index c961c169..fc231089 100644 --- a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/config/LogParserConfig.kt +++ b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/config/LogParserConfig.kt @@ -6,8 +6,8 @@ package org.quiltmc.community.cozy.modules.logs.config -import com.kotlindiscord.kord.extensions.checks.types.Check import dev.kord.core.event.Event +import dev.kordex.core.checks.types.Check import org.quiltmc.community.cozy.modules.logs.types.BaseLogHandler import org.quiltmc.community.cozy.modules.logs.types.LogParser import org.quiltmc.community.cozy.modules.logs.types.LogProcessor diff --git a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/config/SimpleLogParserConfig.kt b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/config/SimpleLogParserConfig.kt index 9dcb1963..b226ec86 100644 --- a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/config/SimpleLogParserConfig.kt +++ b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/config/SimpleLogParserConfig.kt @@ -6,7 +6,7 @@ package org.quiltmc.community.cozy.modules.logs.config -import com.kotlindiscord.kord.extensions.checks.types.Check +import dev.kordex.core.checks.types.Check import org.quiltmc.community.cozy.modules.logs.parsers.EnvironmentParser import org.quiltmc.community.cozy.modules.logs.parsers.LauncherParser import org.quiltmc.community.cozy.modules.logs.parsers.LoaderParser diff --git a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/events/DefaultEventHandler.kt b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/events/DefaultEventHandler.kt index 00577b05..57c0cdd9 100644 --- a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/events/DefaultEventHandler.kt +++ b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/events/DefaultEventHandler.kt @@ -6,8 +6,8 @@ package org.quiltmc.community.cozy.modules.logs.events -import com.kotlindiscord.kord.extensions.extensions.event import dev.kord.core.event.message.MessageCreateEvent +import dev.kordex.core.extensions.event import org.quiltmc.community.cozy.modules.logs.LogParserExtension public class DefaultEventHandler(private val extension: LogParserExtension) : EventHandler { diff --git a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/events/PKEventHandler.kt b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/events/PKEventHandler.kt index 5a113e28..d868279a 100644 --- a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/events/PKEventHandler.kt +++ b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/events/PKEventHandler.kt @@ -6,8 +6,8 @@ package org.quiltmc.community.cozy.modules.logs.events -import com.kotlindiscord.kord.extensions.extensions.event -import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.events.PKMessageCreateEvent +import dev.kordex.core.extensions.event +import dev.kordex.modules.pluralkit.events.PKMessageCreateEvent import org.quiltmc.community.cozy.modules.logs.LogParserExtension public class PKEventHandler(private val extension: LogParserExtension) : EventHandler { diff --git a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/parsers/launchers/TechnicParser.kt b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/parsers/launchers/TechnicParser.kt index 88073e6b..787030fc 100644 --- a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/parsers/launchers/TechnicParser.kt +++ b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/parsers/launchers/TechnicParser.kt @@ -6,8 +6,8 @@ package org.quiltmc.community.cozy.modules.logs.parsers.launchers -import com.kotlindiscord.kord.extensions.utils.capitalizeWords import dev.kord.core.event.Event +import dev.kordex.core.utils.capitalizeWords import org.quiltmc.community.cozy.modules.logs.data.Launcher import org.quiltmc.community.cozy.modules.logs.data.Log import org.quiltmc.community.cozy.modules.logs.data.Order diff --git a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/parsers/quilt/QuiltModsParser.kt b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/parsers/quilt/QuiltModsParser.kt index 75e24d7e..8fc2fafb 100644 --- a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/parsers/quilt/QuiltModsParser.kt +++ b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/parsers/quilt/QuiltModsParser.kt @@ -6,8 +6,8 @@ package org.quiltmc.community.cozy.modules.logs.parsers.quilt -import com.kotlindiscord.kord.extensions.parser.Cursor import dev.kord.core.event.Event +import dev.kordex.parser.Cursor import org.quiltmc.community.cozy.modules.logs.Version import org.quiltmc.community.cozy.modules.logs.data.LoaderType import org.quiltmc.community.cozy.modules.logs.data.Log diff --git a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/processors/PlayerIPProcessor.kt b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/processors/PlayerIPProcessor.kt index 4a766f5b..4752aedf 100644 --- a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/processors/PlayerIPProcessor.kt +++ b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/processors/PlayerIPProcessor.kt @@ -6,8 +6,8 @@ package org.quiltmc.community.cozy.modules.logs.processors -import com.kotlindiscord.kord.extensions.utils.runSuspended import dev.kord.core.event.Event +import dev.kordex.core.utils.runSuspended import org.quiltmc.community.cozy.modules.logs.data.Log import org.quiltmc.community.cozy.modules.logs.data.Order import org.quiltmc.community.cozy.modules.logs.types.LogProcessor diff --git a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/processors/UnknownModProcessor.kt b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/processors/UnknownModProcessor.kt index 76ab1cd6..f382af04 100644 --- a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/processors/UnknownModProcessor.kt +++ b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/processors/UnknownModProcessor.kt @@ -6,8 +6,8 @@ package org.quiltmc.community.cozy.modules.logs.processors -import com.kotlindiscord.kord.extensions.DISCORD_YELLOW import dev.kord.core.event.Event +import dev.kordex.core.DISCORD_YELLOW import org.quiltmc.community.cozy.modules.logs.data.LoaderType import org.quiltmc.community.cozy.modules.logs.data.Log import org.quiltmc.community.cozy.modules.logs.data.Order diff --git a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/types/LogProcessor.kt b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/types/LogProcessor.kt index ac3049c8..7d624524 100644 --- a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/types/LogProcessor.kt +++ b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/types/LogProcessor.kt @@ -6,9 +6,9 @@ package org.quiltmc.community.cozy.modules.logs.types -import com.kotlindiscord.kord.extensions.ExtensibleBot -import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent import dev.kord.core.event.Event +import dev.kordex.core.ExtensibleBot +import dev.kordex.core.koin.KordExKoinComponent import io.ktor.client.* import io.ktor.client.engine.cio.* import io.ktor.client.plugins.* diff --git a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/types/LogRetriever.kt b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/types/LogRetriever.kt index 3d293ef4..250ddcfd 100644 --- a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/types/LogRetriever.kt +++ b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/types/LogRetriever.kt @@ -6,9 +6,9 @@ package org.quiltmc.community.cozy.modules.logs.types -import com.kotlindiscord.kord.extensions.ExtensibleBot -import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent import dev.kord.core.event.Event +import dev.kordex.core.ExtensibleBot +import dev.kordex.core.koin.KordExKoinComponent import io.ktor.client.* import io.ktor.client.engine.cio.* import io.ktor.client.plugins.contentnegotiation.* diff --git a/module-moderation/build.gradle.kts b/module-moderation/build.gradle.kts index d259e0d2..c71e6c67 100644 --- a/module-moderation/build.gradle.kts +++ b/module-moderation/build.gradle.kts @@ -21,6 +21,15 @@ dependencies { } kordEx { - module("annotations") - module("extra-pluralkit") + module("pluralkit") + + plugin { + pluginClass = "org.quiltmc.community.cozy.modules.moderation.ModerationPlugin" + id = "quiltmc-moderation" + version = "1.0.1" + + author = "QuiltMC" + description = "Various moderation tools for the QuiltMC community." + license = "MPL-2.0" + } } diff --git a/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/ModerationExtension.kt b/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/ModerationExtension.kt index 99b2b514..5e3b262c 100644 --- a/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/ModerationExtension.kt +++ b/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/ModerationExtension.kt @@ -8,23 +8,6 @@ package org.quiltmc.community.cozy.modules.moderation -import com.kotlindiscord.kord.extensions.DISCORD_BLURPLE -import com.kotlindiscord.kord.extensions.ExtensibleBot -import com.kotlindiscord.kord.extensions.annotations.DoNotChain -import com.kotlindiscord.kord.extensions.checks.anyGuild -import com.kotlindiscord.kord.extensions.commands.Arguments -import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand -import com.kotlindiscord.kord.extensions.commands.converters.impl.duration -import com.kotlindiscord.kord.extensions.commands.converters.impl.member -import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalDuration -import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalString -import com.kotlindiscord.kord.extensions.extensions.Extension -import com.kotlindiscord.kord.extensions.extensions.chatCommand -import com.kotlindiscord.kord.extensions.extensions.chatGroupCommand -import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand -import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.events.PKMessageCreateEvent -import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.events.ProxiedMessageCreateEvent -import com.kotlindiscord.kord.extensions.utils.* import dev.kord.common.Color import dev.kord.core.behavior.channel.* import dev.kord.core.behavior.channel.threads.edit @@ -33,6 +16,23 @@ import dev.kord.core.entity.channel.GuildMessageChannel import dev.kord.core.entity.channel.TextChannel import dev.kord.core.entity.channel.thread.ThreadChannel import dev.kord.rest.builder.message.embed +import dev.kordex.core.DISCORD_BLURPLE +import dev.kordex.core.ExtensibleBot +import dev.kordex.core.annotations.DoNotChain +import dev.kordex.core.checks.anyGuild +import dev.kordex.core.commands.Arguments +import dev.kordex.core.commands.application.slash.ephemeralSubCommand +import dev.kordex.core.commands.converters.impl.duration +import dev.kordex.core.commands.converters.impl.member +import dev.kordex.core.commands.converters.impl.optionalDuration +import dev.kordex.core.commands.converters.impl.optionalString +import dev.kordex.core.extensions.Extension +import dev.kordex.core.extensions.chatCommand +import dev.kordex.core.extensions.chatGroupCommand +import dev.kordex.core.extensions.ephemeralSlashCommand +import dev.kordex.core.utils.* +import dev.kordex.modules.pluralkit.events.PKMessageCreateEvent +import dev.kordex.modules.pluralkit.events.ProxiedMessageCreateEvent import kotlinx.coroutines.flow.filterIsInstance import kotlinx.coroutines.flow.firstOrNull import kotlinx.coroutines.withTimeoutOrNull diff --git a/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/ModerationPlugin.kt b/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/ModerationPlugin.kt index 88f62270..00f6d80f 100644 --- a/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/ModerationPlugin.kt +++ b/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/ModerationPlugin.kt @@ -6,22 +6,9 @@ package org.quiltmc.community.cozy.modules.moderation -import com.kotlindiscord.kord.extensions.plugins.KordExPlugin -import com.kotlindiscord.kord.extensions.plugins.annotations.plugins.WiredPlugin -import org.pf4j.PluginWrapper +import dev.kordex.core.plugins.KordExPlugin -/** - * Plugin containing the [ModerationExtension], providing various moderation tools. - */ -@WiredPlugin( - id = ModerationPlugin.id, - version = "1.0.1-SNAPSHOT", - - author = "QuiltMC", - description = "Various moderation tools for the QuiltMC community.", - license = "Mozilla Public License 2.0" -) -public class ModerationPlugin(wrapper: PluginWrapper) : KordExPlugin(wrapper) { +public class ModerationPlugin : KordExPlugin() { override suspend fun setup() { // TODO: We can't really use the plugin system just yet since it doesn't currently support any configuration tooling // extension(::ModerationExtension) diff --git a/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/_Utils.kt b/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/_Utils.kt index 0a90c31b..f0b563e6 100644 --- a/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/_Utils.kt +++ b/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/_Utils.kt @@ -6,7 +6,7 @@ package org.quiltmc.community.cozy.modules.moderation -import com.kotlindiscord.kord.extensions.builders.ExtensibleBotBuilder +import dev.kordex.core.builders.ExtensionsBuilder import kotlinx.datetime.Clock import kotlinx.datetime.DateTimePeriod import kotlinx.datetime.TimeZone.Companion.UTC @@ -23,9 +23,9 @@ public fun DateTimePeriod.toTotalSeconds(): Int { return (now.plus(this, UTC) - now).toInt(DurationUnit.SECONDS) } -public fun ExtensibleBotBuilder.ExtensionsBuilder.moderation(config: ModerationConfig) { +public fun ExtensionsBuilder.moderation(config: ModerationConfig) { add { ModerationExtension(config) } } -public fun ExtensibleBotBuilder.ExtensionsBuilder.moderation(body: SimpleModerationConfig.Builder.() -> Unit): Unit = +public fun ExtensionsBuilder.moderation(body: SimpleModerationConfig.Builder.() -> Unit): Unit = moderation(SimpleModerationConfig(body)) diff --git a/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/config/ModerationConfig.kt b/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/config/ModerationConfig.kt index f4c19df4..321eed33 100644 --- a/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/config/ModerationConfig.kt +++ b/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/config/ModerationConfig.kt @@ -6,10 +6,10 @@ package org.quiltmc.community.cozy.modules.moderation.config -import com.kotlindiscord.kord.extensions.checks.types.Check import dev.kord.core.entity.Guild import dev.kord.core.entity.Role import dev.kord.core.entity.channel.GuildMessageChannel +import dev.kordex.core.checks.types.Check /** * Abstract class representing the configuration for the user moderation module. diff --git a/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/config/SimpleModerationConfig.kt b/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/config/SimpleModerationConfig.kt index 0aa6f581..483122f9 100644 --- a/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/config/SimpleModerationConfig.kt +++ b/module-moderation/src/main/kotlin/org/quiltmc/community/cozy/modules/moderation/config/SimpleModerationConfig.kt @@ -6,10 +6,10 @@ package org.quiltmc.community.cozy.modules.moderation.config -import com.kotlindiscord.kord.extensions.checks.types.Check import dev.kord.core.entity.Guild import dev.kord.core.entity.Role import dev.kord.core.entity.channel.GuildMessageChannel +import dev.kordex.core.checks.types.Check import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterIsInstance import kotlinx.coroutines.flow.last diff --git a/module-role-sync/build.gradle.kts b/module-role-sync/build.gradle.kts index 499bb963..962a93bb 100644 --- a/module-role-sync/build.gradle.kts +++ b/module-role-sync/build.gradle.kts @@ -21,5 +21,13 @@ dependencies { } kordEx { - module("annotations") + plugin { + id = "quiltmc-role-sync" + pluginClass = "org.quiltmc.community.cozy.modules.rolesync.RoleSyncPlugin" + version = "1.0.1" + + author = "QuiltMC" + description = "Cross-server role synchronisation plugin" + license = "MPL-2.0" + } } diff --git a/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/RoleSyncExtension.kt b/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/RoleSyncExtension.kt index cd4c4993..a0811a8a 100644 --- a/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/RoleSyncExtension.kt +++ b/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/RoleSyncExtension.kt @@ -6,13 +6,13 @@ package org.quiltmc.community.cozy.modules.rolesync -import com.kotlindiscord.kord.extensions.annotations.DoNotChain -import com.kotlindiscord.kord.extensions.extensions.Extension -import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand -import com.kotlindiscord.kord.extensions.extensions.event -import com.kotlindiscord.kord.extensions.utils.hasRole import dev.kord.core.event.guild.MemberJoinEvent import dev.kord.core.event.guild.MemberUpdateEvent +import dev.kordex.core.annotations.DoNotChain +import dev.kordex.core.extensions.Extension +import dev.kordex.core.extensions.ephemeralSlashCommand +import dev.kordex.core.extensions.event +import dev.kordex.core.utils.hasRole import kotlinx.coroutines.flow.filter import org.quiltmc.community.cozy.modules.rolesync.config.RoleSyncConfig diff --git a/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/RoleSyncPlugin.kt b/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/RoleSyncPlugin.kt index 0bee6c31..6d0e90e3 100644 --- a/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/RoleSyncPlugin.kt +++ b/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/RoleSyncPlugin.kt @@ -6,22 +6,9 @@ package org.quiltmc.community.cozy.modules.rolesync -import com.kotlindiscord.kord.extensions.plugins.KordExPlugin -import com.kotlindiscord.kord.extensions.plugins.annotations.plugins.WiredPlugin -import org.pf4j.PluginWrapper +import dev.kordex.core.plugins.KordExPlugin -/** - * Plugin containing the [RoleSyncPlugin], providing various moderation tools. - */ -@WiredPlugin( - id = RoleSyncPlugin.id, - version = "1.0.1-SNAPSHOT", - - author = "QuiltMC", - description = "Various moderation tools for the QuiltMC community.", - license = "Mozilla Public License 2.0" -) -public class RoleSyncPlugin(wrapper: PluginWrapper) : KordExPlugin(wrapper) { +public class RoleSyncPlugin : KordExPlugin() { override suspend fun setup() { // TODO: We can't really use the plugin system just yet since it doesn't currently support any configuration tooling // extension(::RoleSyncExtension) diff --git a/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/_Utils.kt b/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/_Utils.kt index a485bcf5..088dd95c 100644 --- a/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/_Utils.kt +++ b/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/_Utils.kt @@ -6,11 +6,11 @@ package org.quiltmc.community.cozy.modules.rolesync -import com.kotlindiscord.kord.extensions.ExtensibleBot -import com.kotlindiscord.kord.extensions.builders.ExtensibleBotBuilder import dev.kord.common.entity.Snowflake import dev.kord.core.Kord import dev.kord.core.entity.Role +import dev.kordex.core.ExtensibleBot +import dev.kordex.core.builders.ExtensionsBuilder import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.flatMapConcat @@ -21,9 +21,9 @@ import org.quiltmc.community.cozy.modules.rolesync.config.SimpleRoleSyncConfig public suspend fun getGuildForRoleSnowflake(roleId: Snowflake, bot: ExtensibleBot): Role = bot.getKoin().get().guilds.flatMapConcat { it.roles }.first { it.id == roleId } -public fun ExtensibleBotBuilder.ExtensionsBuilder.rolesync(config: RoleSyncConfig) { +public fun ExtensionsBuilder.rolesync(config: RoleSyncConfig) { add { RoleSyncExtension(config) } } -public fun ExtensibleBotBuilder.ExtensionsBuilder.rolesync(body: SimpleRoleSyncConfig.Builder.() -> Unit): Unit = +public fun ExtensionsBuilder.rolesync(body: SimpleRoleSyncConfig.Builder.() -> Unit): Unit = rolesync(SimpleRoleSyncConfig(body)) diff --git a/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/config/RoleSyncConfig.kt b/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/config/RoleSyncConfig.kt index 985811d6..935c37fc 100644 --- a/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/config/RoleSyncConfig.kt +++ b/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/config/RoleSyncConfig.kt @@ -6,8 +6,8 @@ package org.quiltmc.community.cozy.modules.rolesync.config -import com.kotlindiscord.kord.extensions.checks.types.Check import dev.kord.common.entity.Snowflake +import dev.kordex.core.checks.types.Check /** * The roles to sync between the two guilds. diff --git a/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/config/SimpleRoleSyncConfig.kt b/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/config/SimpleRoleSyncConfig.kt index d2065ec2..6c9e5639 100644 --- a/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/config/SimpleRoleSyncConfig.kt +++ b/module-role-sync/src/main/kotlin/org/quiltmc/community/cozy/modules/rolesync/config/SimpleRoleSyncConfig.kt @@ -6,8 +6,8 @@ package org.quiltmc.community.cozy.modules.rolesync.config -import com.kotlindiscord.kord.extensions.checks.types.Check import dev.kord.common.entity.Snowflake +import dev.kordex.core.checks.types.Check public class SimpleRoleSyncConfig(builder: Builder) : RoleSyncConfig() { private val rolesToSync: MutableList = builder.rolesToSync diff --git a/src/main/kotlin/org/quiltmc/community/App.kt b/src/main/kotlin/org/quiltmc/community/App.kt index dad4fc2f..724f6a3f 100644 --- a/src/main/kotlin/org/quiltmc/community/App.kt +++ b/src/main/kotlin/org/quiltmc/community/App.kt @@ -8,20 +8,19 @@ package org.quiltmc.community -import com.kotlindiscord.kord.extensions.ExtensibleBot -import com.kotlindiscord.kord.extensions.checks.guildFor -import com.kotlindiscord.kord.extensions.modules.extra.mappings.extMappings -import com.kotlindiscord.kord.extensions.modules.extra.phishing.DetectionAction -import com.kotlindiscord.kord.extensions.modules.extra.phishing.extPhishing -import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.extPluralKit -import com.kotlindiscord.kord.extensions.modules.extra.tags.tags -import com.kotlindiscord.kord.extensions.modules.extra.welcome.welcomeChannel -import com.kotlindiscord.kord.extensions.utils.envOrNull -import com.kotlindiscord.kord.extensions.utils.getKoin import dev.kord.core.entity.channel.GuildMessageChannel import dev.kord.gateway.ALL import dev.kord.gateway.Intents import dev.kord.gateway.PrivilegedIntent +import dev.kordex.core.ExtensibleBot +import dev.kordex.core.checks.guildFor +import dev.kordex.core.utils.envOrNull +import dev.kordex.core.utils.getKoin +import dev.kordex.modules.func.phishing.DetectionAction +import dev.kordex.modules.func.phishing.extPhishing +import dev.kordex.modules.func.tags.tags +import dev.kordex.modules.func.welcome.welcomeChannel +import dev.kordex.modules.pluralkit.extPluralKit import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterIsInstance import kotlinx.coroutines.flow.lastOrNull @@ -53,6 +52,14 @@ suspend fun setupCollab() = ExtensibleBot(DISCORD_TOKEN) { common() database() + about { + addGeneral( + "Cozy: Collab", + + "Quilt's Discord bot, Community Collab edition." + ) + } + extensions { sentry { distribution = "collab" @@ -64,9 +71,17 @@ suspend fun setupDev() = ExtensibleBot(DISCORD_TOKEN) { common() database() - extensions { - extMappings { } + about { + addGeneral( + "Cozy: Dev Tools", + "Quilt's Discord bot, Dev Tools edition.\n\n" + + "Once provided mappings commands, but you should use the Allium Discord bot or " + + "[Linkie Web](https://linkie.shedaniel.dev/) going forward." + ) + } + + extensions { if (GITHUB_TOKEN != null) { add(::GithubExtension) } @@ -82,6 +97,16 @@ suspend fun setupQuilt() = ExtensibleBot(DISCORD_TOKEN) { database(true) settings() + about { + addGeneral( + "Cozy: Community", + + "Quilt's Discord bot, Community edition.\n\n" + + "Provides a ton of commands and other utilities, to help staff with moderation and provide users " + + "with day-to-day features on the main Discord server." + ) + } + chatCommands { defaultPrefix = "%" enabled = true @@ -209,6 +234,16 @@ suspend fun setupShowcase() = ExtensibleBot(DISCORD_TOKEN) { database() settings() + about { + addGeneral( + "Cozy: Showcase", + + "Quilt's Discord bot, Showcase edition.\n\n" + + "This bot is currently in development, but someday we hope it'll let you post in the showcase " + + "channels from your project servers." + ) + } + extensions { sentry { distribution = "showcase" @@ -218,8 +253,8 @@ suspend fun setupShowcase() = ExtensibleBot(DISCORD_TOKEN) { suspend fun main() { val bot = when (MODE) { - "dev" -> setupDev() "collab" -> setupCollab() + "dev" -> setupDev() "quilt" -> setupQuilt() "showcase" -> setupShowcase() diff --git a/src/main/kotlin/org/quiltmc/community/DiscordLogAppender.kt b/src/main/kotlin/org/quiltmc/community/DiscordLogAppender.kt index 4f9a03b8..ca93aee1 100644 --- a/src/main/kotlin/org/quiltmc/community/DiscordLogAppender.kt +++ b/src/main/kotlin/org/quiltmc/community/DiscordLogAppender.kt @@ -11,9 +11,6 @@ package org.quiltmc.community import ch.qos.logback.classic.Level import ch.qos.logback.classic.spi.ILoggingEvent import ch.qos.logback.core.AppenderBase -import com.kotlindiscord.kord.extensions.* -import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent -import com.soywiz.korio.async.launch import dev.kord.common.Color import dev.kord.common.annotation.KordExperimental import dev.kord.common.annotation.KordUnsafe @@ -22,7 +19,10 @@ import dev.kord.core.Kord import dev.kord.core.behavior.WebhookBehavior import dev.kord.core.behavior.execute import dev.kord.rest.builder.message.embed +import dev.kordex.core.* +import dev.kordex.core.koin.KordExKoinComponent import io.github.oshai.kotlinlogging.KotlinLogging +import kotlinx.coroutines.launch import kotlinx.datetime.Instant import org.koin.core.component.inject diff --git a/src/main/kotlin/org/quiltmc/community/_Checks.kt b/src/main/kotlin/org/quiltmc/community/_Checks.kt index 2ebb9d7d..30e2677c 100644 --- a/src/main/kotlin/org/quiltmc/community/_Checks.kt +++ b/src/main/kotlin/org/quiltmc/community/_Checks.kt @@ -6,13 +6,13 @@ package org.quiltmc.community -import com.kotlindiscord.kord.extensions.checks.* -import com.kotlindiscord.kord.extensions.checks.types.CheckContext -import com.kotlindiscord.kord.extensions.utils.hasPermission -import com.kotlindiscord.kord.extensions.utils.translate import dev.kord.common.entity.Permission import dev.kord.core.behavior.channel.asChannelOfOrNull import dev.kord.core.entity.channel.CategorizableChannel +import dev.kordex.core.checks.* +import dev.kordex.core.checks.types.CheckContext +import dev.kordex.core.utils.hasPermission +import dev.kordex.core.utils.translate import io.github.oshai.kotlinlogging.KotlinLogging import org.quiltmc.community.database.collections.ServerSettingsCollection diff --git a/src/main/kotlin/org/quiltmc/community/_Constants.kt b/src/main/kotlin/org/quiltmc/community/_Constants.kt index 0d55e45e..5bcf3e6d 100644 --- a/src/main/kotlin/org/quiltmc/community/_Constants.kt +++ b/src/main/kotlin/org/quiltmc/community/_Constants.kt @@ -8,12 +8,12 @@ package org.quiltmc.community -import com.kotlindiscord.kord.extensions.DISCORD_BLURPLE -import com.kotlindiscord.kord.extensions.DISCORD_GREEN -import com.kotlindiscord.kord.extensions.DISCORD_RED -import com.kotlindiscord.kord.extensions.utils.env -import com.kotlindiscord.kord.extensions.utils.envOrNull import dev.kord.common.entity.Snowflake +import dev.kordex.core.DISCORD_BLURPLE +import dev.kordex.core.DISCORD_GREEN +import dev.kordex.core.DISCORD_RED +import dev.kordex.core.utils.env +import dev.kordex.core.utils.envOrNull internal val DISCORD_TOKEN = env("TOKEN") internal val GITHUB_TOKEN = envOrNull("GITHUB_TOKEN") diff --git a/src/main/kotlin/org/quiltmc/community/_Utils.kt b/src/main/kotlin/org/quiltmc/community/_Utils.kt index 13af8bf2..6c4d0223 100644 --- a/src/main/kotlin/org/quiltmc/community/_Utils.kt +++ b/src/main/kotlin/org/quiltmc/community/_Utils.kt @@ -6,14 +6,6 @@ package org.quiltmc.community -import com.kotlindiscord.kord.extensions.builders.ExtensibleBotBuilder -import com.kotlindiscord.kord.extensions.commands.Arguments -import com.kotlindiscord.kord.extensions.commands.application.slash.SlashCommandContext -import com.kotlindiscord.kord.extensions.components.forms.ModalForm -import com.kotlindiscord.kord.extensions.utils.env -import com.kotlindiscord.kord.extensions.utils.envOrNull -import com.kotlindiscord.kord.extensions.utils.getKoin -import com.kotlindiscord.kord.extensions.utils.loadModule import dev.kord.common.entity.ArchiveDuration import dev.kord.common.entity.Snowflake import dev.kord.common.entity.UserFlag @@ -26,7 +18,20 @@ import dev.kord.core.entity.Guild import dev.kord.core.entity.Message import dev.kord.core.entity.channel.GuildMessageChannel import dev.kord.rest.builder.message.EmbedBuilder +import dev.kord.rest.builder.message.actionRow +import dev.kord.rest.builder.message.embed import dev.kord.rest.request.RestRequestException +import dev.kordex.core.DISCORD_FUCHSIA +import dev.kordex.core.builders.AboutBuilder +import dev.kordex.core.builders.ExtensibleBotBuilder +import dev.kordex.core.builders.about.CopyrightType +import dev.kordex.core.commands.Arguments +import dev.kordex.core.commands.application.slash.SlashCommandContext +import dev.kordex.core.components.forms.ModalForm +import dev.kordex.core.utils.env +import dev.kordex.core.utils.envOrNull +import dev.kordex.core.utils.getKoin +import dev.kordex.core.utils.loadModule import io.github.oshai.kotlinlogging.KotlinLogging import kotlinx.coroutines.runBlocking import org.koin.dsl.bind @@ -132,9 +137,23 @@ suspend fun ExtensibleBotBuilder.common() { dataAdapter(::MongoDBDataAdapter) - applicationCommands { - // Need to disable this due to the slash command perms experiment -// syncPermissions = false + about { + copyright("Autolink", "MIT", CopyrightType.Library, "https://github.com/robinst/autolink-java") + + copyright( + "Apache: Commons Text", + "Apache-2.0", + CopyrightType.Library, + "https://commons.apache.org/proper/commons-text/" + ) + + copyright("ExcelKt", "MIT", CopyrightType.Library, "https://github.com/evanrupert/ExcelKt") + copyright("Homoglyph", "MIT", CopyrightType.Library, "https://github.com/codebox/homoglyph") + copyright("KMongo", "Apache-2.0", CopyrightType.Library, "https://litote.org/kmongo/") + copyright("Kotlin Semver", "MIT", CopyrightType.Library, "https://github.com/z4kn4fein/kotlin-semver") + copyright("RgxGen", "Apache-2.0", CopyrightType.Library, "https://github.com/curious-odd-man/RgxGen") + + copyright("GraphQL", "MIT", CopyrightType.Tool, "https://graphql.org/") } extensions { @@ -158,7 +177,7 @@ suspend fun ExtensibleBotBuilder.common() { } plugins { - if (ENVIRONMENT != "production") { + if (this@common.devMode) { // Add plugin build folders here for testing in dev // pluginPath("module-tags/build/libs") } @@ -293,3 +312,34 @@ fun String.replaceParams(pairs: Map): String = this.replaceParams( suspend fun ThreadChannelBehavior.getFirstMessage() = getMessageOrNull(id) + +suspend fun AboutBuilder.addGeneral(name: String, desc: String) { + general { + message { + embed { + color = DISCORD_FUCHSIA + description = desc + title = name + + thumbnail { + url = "https://github.com/QuiltMC/art/blob/master/misc/cozy-icons/original-raster/" + + "cozy-discord.png?raw=true" + } + } + + actionRow { + linkButton("https://opencollective.com/quiltmc") { + label = "Open Collective" + } + + linkButton("https://github.com/QuiltMC/cozy-discord") { + label = "Source Code" + } + + linkButton("https://quiltmc.org") { + label = "Website" + } + } + } + } +} diff --git a/src/main/kotlin/org/quiltmc/community/database/Migrations.kt b/src/main/kotlin/org/quiltmc/community/database/Migrations.kt index 8cf9cd74..b0c19806 100644 --- a/src/main/kotlin/org/quiltmc/community/database/Migrations.kt +++ b/src/main/kotlin/org/quiltmc/community/database/Migrations.kt @@ -6,7 +6,7 @@ package org.quiltmc.community.database -import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent +import dev.kordex.core.koin.KordExKoinComponent import io.github.oshai.kotlinlogging.KotlinLogging import org.koin.core.component.inject import org.quiltmc.community.database.collections.MetaCollection diff --git a/src/main/kotlin/org/quiltmc/community/database/_Utils.kt b/src/main/kotlin/org/quiltmc/community/database/_Utils.kt index deda0524..7372bd31 100644 --- a/src/main/kotlin/org/quiltmc/community/database/_Utils.kt +++ b/src/main/kotlin/org/quiltmc/community/database/_Utils.kt @@ -6,8 +6,8 @@ package org.quiltmc.community.database -import com.kotlindiscord.kord.extensions.utils.getKoin import dev.kord.core.behavior.GuildBehavior +import dev.kordex.core.utils.getKoin import org.quiltmc.community.database.collections.ServerSettingsCollection import org.quiltmc.community.database.entities.ServerSettings diff --git a/src/main/kotlin/org/quiltmc/community/database/collections/AmaConfigCollection.kt b/src/main/kotlin/org/quiltmc/community/database/collections/AmaConfigCollection.kt index d715214d..d8ba779b 100644 --- a/src/main/kotlin/org/quiltmc/community/database/collections/AmaConfigCollection.kt +++ b/src/main/kotlin/org/quiltmc/community/database/collections/AmaConfigCollection.kt @@ -6,9 +6,9 @@ package org.quiltmc.community.database.collections -import com.kotlindiscord.kord.extensions.checks.types.CheckContextWithCache -import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent import dev.kord.common.entity.Snowflake +import dev.kordex.core.checks.types.CheckContextWithCache +import dev.kordex.core.koin.KordExKoinComponent import org.koin.core.component.inject import org.litote.kmongo.eq import org.litote.kmongo.setValue diff --git a/src/main/kotlin/org/quiltmc/community/database/collections/FilterCollection.kt b/src/main/kotlin/org/quiltmc/community/database/collections/FilterCollection.kt index 74878ab1..d857a6b6 100644 --- a/src/main/kotlin/org/quiltmc/community/database/collections/FilterCollection.kt +++ b/src/main/kotlin/org/quiltmc/community/database/collections/FilterCollection.kt @@ -6,7 +6,7 @@ package org.quiltmc.community.database.collections -import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent +import dev.kordex.core.koin.KordExKoinComponent import org.koin.core.component.inject import org.litote.kmongo.eq import org.quiltmc.community.database.Collection diff --git a/src/main/kotlin/org/quiltmc/community/database/collections/GlobalSettingsCollection.kt b/src/main/kotlin/org/quiltmc/community/database/collections/GlobalSettingsCollection.kt index 3a11c06e..55f63858 100644 --- a/src/main/kotlin/org/quiltmc/community/database/collections/GlobalSettingsCollection.kt +++ b/src/main/kotlin/org/quiltmc/community/database/collections/GlobalSettingsCollection.kt @@ -6,8 +6,8 @@ package org.quiltmc.community.database.collections -import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent import com.mongodb.client.result.UpdateResult +import dev.kordex.core.koin.KordExKoinComponent import org.koin.core.component.inject import org.quiltmc.community.database.Collection import org.quiltmc.community.database.Database diff --git a/src/main/kotlin/org/quiltmc/community/database/collections/LinkedMessagesCollection.kt b/src/main/kotlin/org/quiltmc/community/database/collections/LinkedMessagesCollection.kt index eb12b660..bf0ed0ca 100644 --- a/src/main/kotlin/org/quiltmc/community/database/collections/LinkedMessagesCollection.kt +++ b/src/main/kotlin/org/quiltmc/community/database/collections/LinkedMessagesCollection.kt @@ -6,8 +6,8 @@ package org.quiltmc.community.database.collections -import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent import dev.kord.common.entity.Snowflake +import dev.kordex.core.koin.KordExKoinComponent import org.koin.core.component.inject import org.litote.kmongo.contains import org.litote.kmongo.eq diff --git a/src/main/kotlin/org/quiltmc/community/database/collections/MetaCollection.kt b/src/main/kotlin/org/quiltmc/community/database/collections/MetaCollection.kt index e9a1a84f..db870157 100644 --- a/src/main/kotlin/org/quiltmc/community/database/collections/MetaCollection.kt +++ b/src/main/kotlin/org/quiltmc/community/database/collections/MetaCollection.kt @@ -6,7 +6,7 @@ package org.quiltmc.community.database.collections -import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent +import dev.kordex.core.koin.KordExKoinComponent import org.koin.core.component.inject import org.quiltmc.community.database.Collection import org.quiltmc.community.database.Database diff --git a/src/main/kotlin/org/quiltmc/community/database/collections/OwnedThreadCollection.kt b/src/main/kotlin/org/quiltmc/community/database/collections/OwnedThreadCollection.kt index e6fc339d..d7ad66fd 100644 --- a/src/main/kotlin/org/quiltmc/community/database/collections/OwnedThreadCollection.kt +++ b/src/main/kotlin/org/quiltmc/community/database/collections/OwnedThreadCollection.kt @@ -6,11 +6,11 @@ package org.quiltmc.community.database.collections -import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent import dev.kord.common.entity.Snowflake import dev.kord.core.behavior.GuildBehavior import dev.kord.core.behavior.UserBehavior import dev.kord.core.behavior.channel.threads.ThreadChannelBehavior +import dev.kordex.core.koin.KordExKoinComponent import org.koin.core.component.inject import org.litote.kmongo.eq import org.quiltmc.community.database.Collection diff --git a/src/main/kotlin/org/quiltmc/community/database/collections/ServerSettingsCollection.kt b/src/main/kotlin/org/quiltmc/community/database/collections/ServerSettingsCollection.kt index 61e17c13..64841575 100644 --- a/src/main/kotlin/org/quiltmc/community/database/collections/ServerSettingsCollection.kt +++ b/src/main/kotlin/org/quiltmc/community/database/collections/ServerSettingsCollection.kt @@ -6,8 +6,8 @@ package org.quiltmc.community.database.collections -import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent import dev.kord.common.entity.Snowflake +import dev.kordex.core.koin.KordExKoinComponent import org.koin.core.component.inject import org.litote.kmongo.eq import org.litote.kmongo.ne diff --git a/src/main/kotlin/org/quiltmc/community/database/collections/TagsCollection.kt b/src/main/kotlin/org/quiltmc/community/database/collections/TagsCollection.kt index dd3df541..7293db4b 100644 --- a/src/main/kotlin/org/quiltmc/community/database/collections/TagsCollection.kt +++ b/src/main/kotlin/org/quiltmc/community/database/collections/TagsCollection.kt @@ -6,10 +6,10 @@ package org.quiltmc.community.database.collections -import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent -import com.kotlindiscord.kord.extensions.modules.extra.tags.data.Tag -import com.kotlindiscord.kord.extensions.modules.extra.tags.data.TagsData import dev.kord.common.entity.Snowflake +import dev.kordex.core.koin.KordExKoinComponent +import dev.kordex.modules.func.tags.data.Tag +import dev.kordex.modules.func.tags.data.TagsData import org.bson.conversions.Bson import org.koin.core.component.inject import org.litote.kmongo.eq diff --git a/src/main/kotlin/org/quiltmc/community/database/collections/UserFlagsCollection.kt b/src/main/kotlin/org/quiltmc/community/database/collections/UserFlagsCollection.kt index ecbbdb32..b706a0a5 100644 --- a/src/main/kotlin/org/quiltmc/community/database/collections/UserFlagsCollection.kt +++ b/src/main/kotlin/org/quiltmc/community/database/collections/UserFlagsCollection.kt @@ -6,8 +6,8 @@ package org.quiltmc.community.database.collections -import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent import dev.kord.common.entity.Snowflake +import dev.kordex.core.koin.KordExKoinComponent import org.koin.core.component.inject import org.litote.kmongo.eq import org.quiltmc.community.database.Collection diff --git a/src/main/kotlin/org/quiltmc/community/database/collections/WelcomeChannelCollection.kt b/src/main/kotlin/org/quiltmc/community/database/collections/WelcomeChannelCollection.kt index 8b381266..881ab568 100644 --- a/src/main/kotlin/org/quiltmc/community/database/collections/WelcomeChannelCollection.kt +++ b/src/main/kotlin/org/quiltmc/community/database/collections/WelcomeChannelCollection.kt @@ -6,9 +6,9 @@ package org.quiltmc.community.database.collections -import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent -import com.kotlindiscord.kord.extensions.modules.extra.welcome.data.WelcomeChannelData import dev.kord.common.entity.Snowflake +import dev.kordex.core.koin.KordExKoinComponent +import dev.kordex.modules.func.welcome.data.WelcomeChannelData import org.koin.core.component.inject import org.litote.kmongo.eq import org.quiltmc.community.database.Collection diff --git a/src/main/kotlin/org/quiltmc/community/database/entities/AdaptedData.kt b/src/main/kotlin/org/quiltmc/community/database/entities/AdaptedData.kt index 4beb2774..615f6f60 100644 --- a/src/main/kotlin/org/quiltmc/community/database/entities/AdaptedData.kt +++ b/src/main/kotlin/org/quiltmc/community/database/entities/AdaptedData.kt @@ -11,8 +11,8 @@ package org.quiltmc.community.database.entities import com.github.jershell.kbson.UUIDSerializer -import com.kotlindiscord.kord.extensions.storage.StorageType import dev.kord.common.entity.Snowflake +import dev.kordex.core.storage.StorageType import kotlinx.serialization.Serializable import kotlinx.serialization.UseSerializers import org.quiltmc.community.database.Entity diff --git a/src/main/kotlin/org/quiltmc/community/database/entities/GlobalSettings.kt b/src/main/kotlin/org/quiltmc/community/database/entities/GlobalSettings.kt index 6a2d18c4..f92c5e41 100644 --- a/src/main/kotlin/org/quiltmc/community/database/entities/GlobalSettings.kt +++ b/src/main/kotlin/org/quiltmc/community/database/entities/GlobalSettings.kt @@ -11,11 +11,11 @@ package org.quiltmc.community.database.entities import com.github.jershell.kbson.UUIDSerializer -import com.kotlindiscord.kord.extensions.DISCORD_BLURPLE -import com.kotlindiscord.kord.extensions.utils.getKoin import dev.kord.common.entity.Snowflake import dev.kord.core.Kord import dev.kord.rest.builder.message.EmbedBuilder +import dev.kordex.core.DISCORD_BLURPLE +import dev.kordex.core.utils.getKoin import kotlinx.serialization.Serializable import kotlinx.serialization.UseSerializers import org.quiltmc.community.database.Entity diff --git a/src/main/kotlin/org/quiltmc/community/database/entities/LinkedMessages.kt b/src/main/kotlin/org/quiltmc/community/database/entities/LinkedMessages.kt index 38690b29..f55d1493 100644 --- a/src/main/kotlin/org/quiltmc/community/database/entities/LinkedMessages.kt +++ b/src/main/kotlin/org/quiltmc/community/database/entities/LinkedMessages.kt @@ -8,8 +8,8 @@ package org.quiltmc.community.database.entities -import com.kotlindiscord.kord.extensions.utils.getKoin import dev.kord.common.entity.Snowflake +import dev.kordex.core.utils.getKoin import kotlinx.serialization.Serializable import org.quiltmc.community.database.Entity import org.quiltmc.community.database.collections.LinkedMessagesCollection diff --git a/src/main/kotlin/org/quiltmc/community/database/entities/ServerSettings.kt b/src/main/kotlin/org/quiltmc/community/database/entities/ServerSettings.kt index 3bef0617..4d28ae8e 100644 --- a/src/main/kotlin/org/quiltmc/community/database/entities/ServerSettings.kt +++ b/src/main/kotlin/org/quiltmc/community/database/entities/ServerSettings.kt @@ -8,14 +8,14 @@ package org.quiltmc.community.database.entities -import com.kotlindiscord.kord.extensions.DISCORD_BLURPLE -import com.kotlindiscord.kord.extensions.utils.getKoin import dev.kord.common.entity.Snowflake import dev.kord.core.Kord import dev.kord.core.behavior.getChannelOfOrNull import dev.kord.core.entity.channel.Category import dev.kord.core.entity.channel.TopGuildMessageChannel import dev.kord.rest.builder.message.EmbedBuilder +import dev.kordex.core.DISCORD_BLURPLE +import dev.kordex.core.utils.getKoin import kotlinx.serialization.Serializable import org.quiltmc.community.database.Entity import org.quiltmc.community.database.collections.ServerSettingsCollection diff --git a/src/main/kotlin/org/quiltmc/community/database/entities/TagEntity.kt b/src/main/kotlin/org/quiltmc/community/database/entities/TagEntity.kt index 05cca359..fe92a39a 100644 --- a/src/main/kotlin/org/quiltmc/community/database/entities/TagEntity.kt +++ b/src/main/kotlin/org/quiltmc/community/database/entities/TagEntity.kt @@ -11,9 +11,9 @@ package org.quiltmc.community.database.entities import com.github.jershell.kbson.UUIDSerializer -import com.kotlindiscord.kord.extensions.modules.extra.tags.data.Tag import dev.kord.common.Color import dev.kord.common.entity.Snowflake +import dev.kordex.modules.func.tags.data.Tag import kotlinx.serialization.Serializable import kotlinx.serialization.UseSerializers import org.quiltmc.community.database.Entity diff --git a/src/main/kotlin/org/quiltmc/community/database/entities/UserFlags.kt b/src/main/kotlin/org/quiltmc/community/database/entities/UserFlags.kt index c02bcd40..0c9fc53f 100644 --- a/src/main/kotlin/org/quiltmc/community/database/entities/UserFlags.kt +++ b/src/main/kotlin/org/quiltmc/community/database/entities/UserFlags.kt @@ -8,8 +8,8 @@ package org.quiltmc.community.database.entities -import com.kotlindiscord.kord.extensions.utils.getKoin import dev.kord.common.entity.Snowflake +import dev.kordex.core.utils.getKoin import kotlinx.serialization.Serializable import org.quiltmc.community.database.Entity import org.quiltmc.community.database.collections.UserFlagsCollection diff --git a/src/main/kotlin/org/quiltmc/community/database/enums/QuiltServerType.kt b/src/main/kotlin/org/quiltmc/community/database/enums/QuiltServerType.kt index aba4db65..7eaab5ce 100644 --- a/src/main/kotlin/org/quiltmc/community/database/enums/QuiltServerType.kt +++ b/src/main/kotlin/org/quiltmc/community/database/enums/QuiltServerType.kt @@ -6,7 +6,7 @@ package org.quiltmc.community.database.enums -import com.kotlindiscord.kord.extensions.commands.application.slash.converters.ChoiceEnum +import dev.kordex.core.commands.application.slash.converters.ChoiceEnum import kotlinx.serialization.Serializable @Serializable diff --git a/src/main/kotlin/org/quiltmc/community/database/storage/MongoDBDataAdapter.kt b/src/main/kotlin/org/quiltmc/community/database/storage/MongoDBDataAdapter.kt index 431d371c..838f87fd 100644 --- a/src/main/kotlin/org/quiltmc/community/database/storage/MongoDBDataAdapter.kt +++ b/src/main/kotlin/org/quiltmc/community/database/storage/MongoDBDataAdapter.kt @@ -9,10 +9,10 @@ package org.quiltmc.community.database.storage -import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent -import com.kotlindiscord.kord.extensions.storage.Data -import com.kotlindiscord.kord.extensions.storage.DataAdapter -import com.kotlindiscord.kord.extensions.storage.StorageUnit +import dev.kordex.core.koin.KordExKoinComponent +import dev.kordex.core.storage.Data +import dev.kordex.core.storage.DataAdapter +import dev.kordex.core.storage.StorageUnit import kotlinx.serialization.InternalSerializationApi import kotlinx.serialization.json.Json import kotlinx.serialization.serializer diff --git a/src/main/kotlin/org/quiltmc/community/modes/collab/extensions/BanRelayExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/collab/extensions/BanRelayExtension.kt index 09f2f59c..e9207d0b 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/collab/extensions/BanRelayExtension.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/collab/extensions/BanRelayExtension.kt @@ -6,7 +6,7 @@ package org.quiltmc.community.modes.collab.extensions -import com.kotlindiscord.kord.extensions.extensions.Extension +import dev.kordex.core.extensions.Extension class BanRelayExtension : Extension() { override val name = "ban-relay" diff --git a/src/main/kotlin/org/quiltmc/community/modes/collab/extensions/CollabSettingsExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/collab/extensions/CollabSettingsExtension.kt index 015f5ec6..ebba0e8e 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/collab/extensions/CollabSettingsExtension.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/collab/extensions/CollabSettingsExtension.kt @@ -6,7 +6,7 @@ package org.quiltmc.community.modes.collab.extensions -import com.kotlindiscord.kord.extensions.extensions.Extension +import dev.kordex.core.extensions.Extension class CollabSettingsExtension : Extension() { override val name = "collab-settings" diff --git a/src/main/kotlin/org/quiltmc/community/modes/collab/extensions/LookupExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/collab/extensions/LookupExtension.kt index 0305b71d..10b712b6 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/collab/extensions/LookupExtension.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/collab/extensions/LookupExtension.kt @@ -8,18 +8,18 @@ package org.quiltmc.community.modes.collab.extensions -import com.kotlindiscord.kord.extensions.DISCORD_BLURPLE -import com.kotlindiscord.kord.extensions.commands.Arguments -import com.kotlindiscord.kord.extensions.commands.converters.impl.snowflake -import com.kotlindiscord.kord.extensions.commands.converters.impl.string -import com.kotlindiscord.kord.extensions.extensions.Extension -import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand -import com.kotlindiscord.kord.extensions.time.TimestampType -import com.kotlindiscord.kord.extensions.time.toDiscord -import com.kotlindiscord.kord.extensions.utils.translate import dev.kord.common.entity.Snowflake import dev.kord.rest.Image import dev.kord.rest.builder.message.embed +import dev.kordex.core.DISCORD_BLURPLE +import dev.kordex.core.commands.Arguments +import dev.kordex.core.commands.converters.impl.snowflake +import dev.kordex.core.commands.converters.impl.string +import dev.kordex.core.extensions.Extension +import dev.kordex.core.extensions.publicSlashCommand +import dev.kordex.core.time.TimestampType +import dev.kordex.core.time.toDiscord +import dev.kordex.core.utils.translate import io.ktor.client.* import io.ktor.client.call.* import io.ktor.client.plugins.* diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/ForumExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/ForumExtension.kt index 16384419..771cb435 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/ForumExtension.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/ForumExtension.kt @@ -9,29 +9,6 @@ package org.quiltmc.community.modes.quilt.extensions -import com.kotlindiscord.kord.extensions.DiscordRelayedException -import com.kotlindiscord.kord.extensions.checks.* -import com.kotlindiscord.kord.extensions.commands.Arguments -import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand -import com.kotlindiscord.kord.extensions.commands.converters.impl.channel -import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalChannel -import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalTag -import com.kotlindiscord.kord.extensions.commands.converters.impl.tag -import com.kotlindiscord.kord.extensions.components.forms.ModalForm -import com.kotlindiscord.kord.extensions.extensions.Extension -import com.kotlindiscord.kord.extensions.extensions.ephemeralMessageCommand -import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand -import com.kotlindiscord.kord.extensions.extensions.event -import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.events.PKMessageCreateEvent -import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.events.PKMessageUpdateEvent -import com.kotlindiscord.kord.extensions.modules.unsafe.annotations.UnsafeAPI -import com.kotlindiscord.kord.extensions.modules.unsafe.extensions.unsafeSubCommand -import com.kotlindiscord.kord.extensions.modules.unsafe.types.InitialSlashCommandResponse -import com.kotlindiscord.kord.extensions.modules.unsafe.types.ackEphemeral -import com.kotlindiscord.kord.extensions.utils.addReaction -import com.kotlindiscord.kord.extensions.utils.deleteOwnReaction -import com.kotlindiscord.kord.extensions.utils.ensureWebhook -import com.kotlindiscord.kord.extensions.utils.extraData import dev.kord.common.annotation.KordUnsafe import dev.kord.common.entity.ChannelFlag import dev.kord.common.entity.ChannelType @@ -49,6 +26,28 @@ import dev.kord.core.entity.channel.NewsChannel import dev.kord.core.entity.channel.TopGuildMessageChannel import dev.kord.core.entity.channel.thread.TextChannelThread import dev.kord.core.entity.channel.thread.ThreadChannel +import dev.kordex.core.DiscordRelayedException +import dev.kordex.core.checks.* +import dev.kordex.core.commands.Arguments +import dev.kordex.core.commands.application.slash.ephemeralSubCommand +import dev.kordex.core.commands.converters.impl.channel +import dev.kordex.core.commands.converters.impl.optionalChannel +import dev.kordex.core.commands.converters.impl.optionalTag +import dev.kordex.core.commands.converters.impl.tag +import dev.kordex.core.components.forms.ModalForm +import dev.kordex.core.extensions.Extension +import dev.kordex.core.extensions.ephemeralMessageCommand +import dev.kordex.core.extensions.ephemeralSlashCommand +import dev.kordex.core.extensions.event +import dev.kordex.core.utils.addReaction +import dev.kordex.core.utils.deleteOwnReaction +import dev.kordex.core.utils.ensureWebhook +import dev.kordex.core.utils.extraData +import dev.kordex.modules.dev.unsafe.annotations.UnsafeAPI +import dev.kordex.modules.dev.unsafe.commands.slash.InitialSlashCommandResponse +import dev.kordex.modules.dev.unsafe.extensions.unsafeSubCommand +import dev.kordex.modules.pluralkit.events.PKMessageCreateEvent +import dev.kordex.modules.pluralkit.events.PKMessageUpdateEvent import io.ktor.client.* import io.ktor.client.call.* import io.ktor.client.request.* diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/ShowcaseExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/ShowcaseExtension.kt index 230413d2..16713a5c 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/ShowcaseExtension.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/ShowcaseExtension.kt @@ -8,25 +8,6 @@ package org.quiltmc.community.modes.quilt.extensions -import com.kotlindiscord.kord.extensions.checks.anyGuild -import com.kotlindiscord.kord.extensions.checks.hasPermission -import com.kotlindiscord.kord.extensions.checks.isNotInThread -import com.kotlindiscord.kord.extensions.checks.notHasPermission -import com.kotlindiscord.kord.extensions.commands.Arguments -import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand -import com.kotlindiscord.kord.extensions.commands.application.slash.group -import com.kotlindiscord.kord.extensions.commands.converters.impl.channel -import com.kotlindiscord.kord.extensions.commands.converters.impl.string -import com.kotlindiscord.kord.extensions.extensions.Extension -import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand -import com.kotlindiscord.kord.extensions.extensions.event -import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.events.PKMessageCreateEvent -import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.events.ProxiedMessageCreateEvent -import com.kotlindiscord.kord.extensions.storage.StorageType -import com.kotlindiscord.kord.extensions.storage.StorageUnit -import com.kotlindiscord.kord.extensions.utils.authorId -import com.kotlindiscord.kord.extensions.utils.capitalizeWords -import com.kotlindiscord.kord.extensions.utils.dm import dev.kord.common.entity.ChannelType import dev.kord.common.entity.MessageType import dev.kord.common.entity.Permission @@ -41,6 +22,25 @@ import dev.kord.core.entity.channel.CategorizableChannel import dev.kord.core.entity.channel.TextChannel import dev.kord.core.entity.channel.thread.TextChannelThread import dev.kord.core.event.message.ReactionAddEvent +import dev.kordex.core.checks.anyGuild +import dev.kordex.core.checks.hasPermission +import dev.kordex.core.checks.isNotInThread +import dev.kordex.core.checks.notHasPermission +import dev.kordex.core.commands.Arguments +import dev.kordex.core.commands.application.slash.ephemeralSubCommand +import dev.kordex.core.commands.application.slash.group +import dev.kordex.core.commands.converters.impl.channel +import dev.kordex.core.commands.converters.impl.string +import dev.kordex.core.extensions.Extension +import dev.kordex.core.extensions.ephemeralSlashCommand +import dev.kordex.core.extensions.event +import dev.kordex.core.storage.StorageType +import dev.kordex.core.storage.StorageUnit +import dev.kordex.core.utils.authorId +import dev.kordex.core.utils.capitalizeWords +import dev.kordex.core.utils.dm +import dev.kordex.modules.pluralkit.events.PKMessageCreateEvent +import dev.kordex.modules.pluralkit.events.ProxiedMessageCreateEvent import kotlinx.coroutines.delay import kotlinx.datetime.Clock import kotlinx.datetime.Instant diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/SyncExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/SyncExtension.kt index 9a500415..a69b7eb2 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/SyncExtension.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/SyncExtension.kt @@ -8,16 +8,6 @@ package org.quiltmc.community.modes.quilt.extensions -import com.kotlindiscord.kord.extensions.checks.hasPermission -import com.kotlindiscord.kord.extensions.checks.types.CheckContext -import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand -import com.kotlindiscord.kord.extensions.extensions.Extension -import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand -import com.kotlindiscord.kord.extensions.extensions.event -import com.kotlindiscord.kord.extensions.sentry.BreadcrumbType -import com.kotlindiscord.kord.extensions.utils.hasPermission -import com.kotlindiscord.kord.extensions.utils.timeoutUntil -import com.kotlindiscord.kord.extensions.utils.translate import dev.kord.common.entity.Permission import dev.kord.common.entity.Snowflake import dev.kord.core.behavior.ban @@ -28,6 +18,16 @@ import dev.kord.core.event.guild.BanAddEvent import dev.kord.core.event.guild.BanRemoveEvent import dev.kord.core.event.guild.MemberUpdateEvent import dev.kord.rest.builder.message.embed +import dev.kordex.core.checks.hasPermission +import dev.kordex.core.checks.types.CheckContext +import dev.kordex.core.commands.application.slash.ephemeralSubCommand +import dev.kordex.core.extensions.Extension +import dev.kordex.core.extensions.ephemeralSlashCommand +import dev.kordex.core.extensions.event +import dev.kordex.core.sentry.BreadcrumbType +import dev.kordex.core.utils.hasPermission +import dev.kordex.core.utils.timeoutUntil +import dev.kordex.core.utils.translate import io.github.oshai.kotlinlogging.KotlinLogging import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.toList diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/UtilityExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/UtilityExtension.kt index eb4c153d..1bf822e8 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/UtilityExtension.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/UtilityExtension.kt @@ -10,29 +10,6 @@ package org.quiltmc.community.modes.quilt.extensions -import com.kotlindiscord.kord.extensions.DISCORD_BLURPLE -import com.kotlindiscord.kord.extensions.DISCORD_GREEN -import com.kotlindiscord.kord.extensions.DISCORD_RED -import com.kotlindiscord.kord.extensions.DiscordRelayedException -import com.kotlindiscord.kord.extensions.annotations.DoNotChain -import com.kotlindiscord.kord.extensions.annotations.UnexpectedFunctionBehaviour -import com.kotlindiscord.kord.extensions.checks.channelType -import com.kotlindiscord.kord.extensions.checks.hasPermission -import com.kotlindiscord.kord.extensions.checks.isInThread -import com.kotlindiscord.kord.extensions.checks.isNotBot -import com.kotlindiscord.kord.extensions.commands.Arguments -import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand -import com.kotlindiscord.kord.extensions.commands.application.slash.publicSubCommand -import com.kotlindiscord.kord.extensions.commands.converters.impl.* -import com.kotlindiscord.kord.extensions.components.ComponentContainer -import com.kotlindiscord.kord.extensions.components.components -import com.kotlindiscord.kord.extensions.components.ephemeralButton -import com.kotlindiscord.kord.extensions.components.forms.ModalForm -import com.kotlindiscord.kord.extensions.extensions.* -import com.kotlindiscord.kord.extensions.i18n.SupportedLocales -import com.kotlindiscord.kord.extensions.time.TimestampType -import com.kotlindiscord.kord.extensions.time.toDiscord -import com.kotlindiscord.kord.extensions.utils.* import dev.kord.common.annotation.KordPreview import dev.kord.common.entity.* import dev.kord.core.behavior.channel.* @@ -50,6 +27,29 @@ import dev.kord.core.event.guild.MemberUpdateEvent import dev.kord.core.event.message.MessageCreateEvent import dev.kord.rest.builder.message.allowedMentions import dev.kord.rest.builder.message.embed +import dev.kordex.core.DISCORD_BLURPLE +import dev.kordex.core.DISCORD_GREEN +import dev.kordex.core.DISCORD_RED +import dev.kordex.core.DiscordRelayedException +import dev.kordex.core.annotations.DoNotChain +import dev.kordex.core.annotations.UnexpectedFunctionBehaviour +import dev.kordex.core.checks.channelType +import dev.kordex.core.checks.hasPermission +import dev.kordex.core.checks.isInThread +import dev.kordex.core.checks.isNotBot +import dev.kordex.core.commands.Arguments +import dev.kordex.core.commands.application.slash.ephemeralSubCommand +import dev.kordex.core.commands.application.slash.publicSubCommand +import dev.kordex.core.commands.converters.impl.* +import dev.kordex.core.components.ComponentContainer +import dev.kordex.core.components.components +import dev.kordex.core.components.ephemeralButton +import dev.kordex.core.components.forms.ModalForm +import dev.kordex.core.extensions.* +import dev.kordex.core.i18n.SupportedLocales +import dev.kordex.core.time.TimestampType +import dev.kordex.core.time.toDiscord +import dev.kordex.core.utils.* import io.github.oshai.kotlinlogging.KotlinLogging import io.ktor.client.request.forms.* import io.ktor.utils.io.jvm.javaio.* diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/filtering/FilterAction.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/filtering/FilterAction.kt index d766b662..c98d420b 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/filtering/FilterAction.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/filtering/FilterAction.kt @@ -6,7 +6,7 @@ package org.quiltmc.community.modes.quilt.extensions.filtering -import com.kotlindiscord.kord.extensions.commands.application.slash.converters.ChoiceEnum +import dev.kordex.core.commands.application.slash.converters.ChoiceEnum import kotlinx.serialization.Serializable @Serializable diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/filtering/FilterExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/filtering/FilterExtension.kt index 1f486501..6deda99b 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/filtering/FilterExtension.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/filtering/FilterExtension.kt @@ -11,23 +11,6 @@ package org.quiltmc.community.modes.quilt.extensions.filtering import com.github.curiousoddman.rgxgen.RgxGen import com.github.curiousoddman.rgxgen.config.RgxGenOption import com.github.curiousoddman.rgxgen.config.RgxGenProperties -import com.kotlindiscord.kord.extensions.DISCORD_BLURPLE -import com.kotlindiscord.kord.extensions.DISCORD_GREEN -import com.kotlindiscord.kord.extensions.DISCORD_RED -import com.kotlindiscord.kord.extensions.DISCORD_YELLOW -import com.kotlindiscord.kord.extensions.annotations.DoNotChain -import com.kotlindiscord.kord.extensions.checks.isNotBot -import com.kotlindiscord.kord.extensions.commands.Arguments -import com.kotlindiscord.kord.extensions.commands.application.slash.converters.impl.enumChoice -import com.kotlindiscord.kord.extensions.commands.application.slash.converters.impl.optionalEnumChoice -import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand -import com.kotlindiscord.kord.extensions.commands.converters.impl.defaultingBoolean -import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalString -import com.kotlindiscord.kord.extensions.commands.converters.impl.string -import com.kotlindiscord.kord.extensions.extensions.Extension -import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand -import com.kotlindiscord.kord.extensions.extensions.event -import com.kotlindiscord.kord.extensions.utils.* import dev.kord.common.entity.Snowflake import dev.kord.core.behavior.ban import dev.kord.core.behavior.channel.createEmbed @@ -41,6 +24,23 @@ import dev.kord.core.event.message.MessageUpdateEvent import dev.kord.core.event.user.UserUpdateEvent import dev.kord.rest.builder.message.EmbedBuilder import dev.kord.rest.builder.message.embed +import dev.kordex.core.DISCORD_BLURPLE +import dev.kordex.core.DISCORD_GREEN +import dev.kordex.core.DISCORD_RED +import dev.kordex.core.DISCORD_YELLOW +import dev.kordex.core.annotations.DoNotChain +import dev.kordex.core.checks.isNotBot +import dev.kordex.core.commands.Arguments +import dev.kordex.core.commands.application.slash.converters.impl.enumChoice +import dev.kordex.core.commands.application.slash.converters.impl.optionalEnumChoice +import dev.kordex.core.commands.application.slash.ephemeralSubCommand +import dev.kordex.core.commands.converters.impl.defaultingBoolean +import dev.kordex.core.commands.converters.impl.optionalString +import dev.kordex.core.commands.converters.impl.string +import dev.kordex.core.extensions.Extension +import dev.kordex.core.extensions.ephemeralSlashCommand +import dev.kordex.core.extensions.event +import dev.kordex.core.utils.* import io.github.oshai.kotlinlogging.KotlinLogging import net.codebox.homoglyph.HomoglyphBuilder import org.koin.core.component.inject diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/filtering/MatchTarget.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/filtering/MatchTarget.kt index 64903786..6d3a1695 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/filtering/MatchTarget.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/filtering/MatchTarget.kt @@ -6,7 +6,7 @@ package org.quiltmc.community.modes.quilt.extensions.filtering -import com.kotlindiscord.kord.extensions.commands.application.slash.converters.ChoiceEnum +import dev.kordex.core.commands.application.slash.converters.ChoiceEnum import kotlinx.serialization.Serializable @Serializable diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/filtering/MatchType.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/filtering/MatchType.kt index a33fec9b..0869031f 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/filtering/MatchType.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/filtering/MatchType.kt @@ -6,7 +6,7 @@ package org.quiltmc.community.modes.quilt.extensions.filtering -import com.kotlindiscord.kord.extensions.commands.application.slash.converters.ChoiceEnum +import dev.kordex.core.commands.application.slash.converters.ChoiceEnum import kotlinx.serialization.Serializable @Serializable diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/github/GithubExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/github/GithubExtension.kt index 4f082481..2163886d 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/github/GithubExtension.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/github/GithubExtension.kt @@ -9,19 +9,19 @@ package org.quiltmc.community.modes.quilt.extensions.github import com.expediagroup.graphql.client.ktor.GraphQLKtorClient -import com.kotlindiscord.kord.extensions.DISCORD_GREEN -import com.kotlindiscord.kord.extensions.DISCORD_RED -import com.kotlindiscord.kord.extensions.commands.Arguments -import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand -import com.kotlindiscord.kord.extensions.commands.application.slash.group -import com.kotlindiscord.kord.extensions.commands.converters.impl.defaultingString -import com.kotlindiscord.kord.extensions.commands.converters.impl.int -import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalString -import com.kotlindiscord.kord.extensions.commands.converters.impl.string -import com.kotlindiscord.kord.extensions.extensions.Extension -import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand import dev.kord.common.entity.Permission import dev.kord.core.behavior.channel.createEmbed +import dev.kordex.core.DISCORD_GREEN +import dev.kordex.core.DISCORD_RED +import dev.kordex.core.commands.Arguments +import dev.kordex.core.commands.application.slash.ephemeralSubCommand +import dev.kordex.core.commands.application.slash.group +import dev.kordex.core.commands.converters.impl.defaultingString +import dev.kordex.core.commands.converters.impl.int +import dev.kordex.core.commands.converters.impl.optionalString +import dev.kordex.core.commands.converters.impl.string +import dev.kordex.core.extensions.Extension +import dev.kordex.core.extensions.ephemeralSlashCommand import io.github.oshai.kotlinlogging.KotlinLogging import io.ktor.client.* import io.ktor.client.call.* diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/messagelog/MessageLogExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/messagelog/MessageLogExtension.kt index b6d36d84..80792bfd 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/messagelog/MessageLogExtension.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/messagelog/MessageLogExtension.kt @@ -8,11 +8,6 @@ package org.quiltmc.community.modes.quilt.extensions.messagelog -import com.kotlindiscord.kord.extensions.extensions.Extension -import com.kotlindiscord.kord.extensions.extensions.event -import com.kotlindiscord.kord.extensions.utils.deltas.MessageDelta -import com.kotlindiscord.kord.extensions.utils.getJumpUrl -import com.kotlindiscord.kord.extensions.utils.isEphemeral import dev.kord.common.entity.Snowflake import dev.kord.common.entity.optional.Optional import dev.kord.core.entity.Guild @@ -29,6 +24,11 @@ import dev.kord.core.event.message.MessageUpdateEvent import dev.kord.rest.builder.message.EmbedBuilder import dev.kord.rest.builder.message.allowedMentions import dev.kord.rest.builder.message.embed +import dev.kordex.core.extensions.Extension +import dev.kordex.core.extensions.event +import dev.kordex.core.utils.deltas.MessageDelta +import dev.kordex.core.utils.getJumpUrl +import dev.kordex.core.utils.isEphemeral import io.github.oshai.kotlinlogging.KotlinLogging import io.ktor.client.request.forms.* import io.ktor.utils.io.jvm.javaio.* diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/minecraft/MinecraftExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/minecraft/MinecraftExtension.kt index b0418709..f877b722 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/minecraft/MinecraftExtension.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/minecraft/MinecraftExtension.kt @@ -6,22 +6,11 @@ package org.quiltmc.community.modes.quilt.extensions.minecraft -import com.kotlindiscord.kord.extensions.DISCORD_FUCHSIA -import com.kotlindiscord.kord.extensions.DISCORD_GREEN -import com.kotlindiscord.kord.extensions.checks.hasPermission -import com.kotlindiscord.kord.extensions.commands.Arguments -import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand -import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalString -import com.kotlindiscord.kord.extensions.extensions.Extension -import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand -import com.kotlindiscord.kord.extensions.pagination.pages.Page -import com.kotlindiscord.kord.extensions.utils.scheduling.Scheduler -import com.kotlindiscord.kord.extensions.utils.scheduling.Task -import com.kotlindiscord.kord.extensions.utils.toReaction import dev.kord.common.annotation.KordPreview import dev.kord.common.entity.Permission import dev.kord.common.entity.Snowflake import dev.kord.core.behavior.channel.createMessage +import dev.kord.core.behavior.edit import dev.kord.core.builder.components.emoji import dev.kord.core.entity.ReactionEmoji import dev.kord.core.entity.channel.NewsChannel @@ -30,6 +19,22 @@ import dev.kord.core.entity.channel.TopGuildMessageChannel import dev.kord.rest.builder.message.MessageBuilder import dev.kord.rest.builder.message.actionRow import dev.kord.rest.builder.message.embed +import dev.kordex.core.DISCORD_FUCHSIA +import dev.kordex.core.DISCORD_GREEN +import dev.kordex.core.checks.hasPermission +import dev.kordex.core.checks.or +import dev.kordex.core.commands.Arguments +import dev.kordex.core.commands.application.slash.ephemeralSubCommand +import dev.kordex.core.commands.converters.impl.message +import dev.kordex.core.commands.converters.impl.optionalString +import dev.kordex.core.commands.converters.impl.string +import dev.kordex.core.extensions.Extension +import dev.kordex.core.extensions.ephemeralSlashCommand +import dev.kordex.core.pagination.pages.Page +import dev.kordex.core.utils.scheduling.Scheduler +import dev.kordex.core.utils.scheduling.Task +import dev.kordex.core.utils.toReaction +import dev.kordex.parser.Cursor import io.github.oshai.kotlinlogging.KotlinLogging import io.ktor.client.* import io.ktor.client.call.* @@ -40,6 +45,7 @@ import kotlinx.datetime.Clock import kotlinx.serialization.json.Json import org.apache.commons.text.StringEscapeUtils import org.quiltmc.community.* +import kotlin.system.exitProcess private const val PAGINATOR_TIMEOUT = 60_000L // One minute private const val CHUNK_SIZE = 10 @@ -49,7 +55,7 @@ private const val JSON_URL = "$BASE_URL/javaPatchNotes.json" private const val CHECK_DELAY = 60L -private val LINK_REGEX = "[^\"]+)\"[^>]*>(?[^<]+)".toRegex() +private val LINK_REGEX = "[^\"\\s]+)\"?[^>]*>(?[^<]+)".toRegex() @Suppress("MagicNumber", "UnderscoresInNumericLiterals") private val CHANNELS: List = listOf( @@ -160,9 +166,13 @@ class MinecraftExtension : Extension() { name = "forget" description = "Forget a version (the last one by default), allowing it to be relayed again." - check { hasBaseModeratorRole() } + check { + hasBaseModeratorRole() - check { hasPermission(Permission.Administrator) } + or { + hasPermission(Permission.Administrator) + } + } action { if (!::currentEntries.isInitialized) { @@ -189,11 +199,52 @@ class MinecraftExtension : Extension() { } } + ephemeralSubCommand(::UpdateArguments) { + name = "update" + description = "Edit the given message to replace its embed. Useful when formatting code changes." + + check { + hasBaseModeratorRole() + + or { + hasPermission(Permission.Administrator) + } + } + + action { + if (!::currentEntries.isInitialized) { + respond { content = "Still setting up - try again a bit later!" } + return@action + } + + val entry = currentEntries.entries.firstOrNull { + it.version.equals(arguments.version, true) + } + + if (entry == null) { + respond { content = "Unknown version supplied: `${arguments.version}`" } + return@action + } + + arguments.message.edit { + patchNotes(entry.get()) + } + + respond { content = "Message edit to match version: `${entry.version}`" } + } + } + ephemeralSubCommand { name = "run" description = "Run the check task now, without waiting for it." - check { hasBaseModeratorRole() } + check { + hasBaseModeratorRole() + + or { + hasPermission(Permission.Administrator) + } + } action { respond { content = "Checking now..." } @@ -247,7 +298,7 @@ class MinecraftExtension : Extension() { .forEach { it.relay(patchNote) } fun String.formatHTML(): String { - var result = this + var result = StringEscapeUtils.unescapeHtml4(trim('\n')) result = result.replace("\u200B", "") result = result.replace("

", "") @@ -261,6 +312,9 @@ class MinecraftExtension : Extension() { result = result.replace("", "**") result = result.replace("", "**") + result = result.replace("", "_") + result = result.replace("", "_") + result = result.replace("", "`") result = result.replace("", "`") @@ -286,10 +340,55 @@ class MinecraftExtension : Extension() { ) } - return StringEscapeUtils.unescapeHtml4(result.trim('\n')) + val cursor = Cursor(result) + var isQuote = false + + result = "" + + @Suppress("LoopWithTooManyJumpStatements") // Nah. + while (cursor.hasNext) { + result = result + ( + cursor.consumeWhile { it != '<' }?.prefixQuote(isQuote) + ?: break + ) + + val temp = cursor.consumeWhile { it != '>' } + ?.plus(cursor.nextOrNull() ?: "") + ?: break + + if (temp == "
") { + isQuote = true + + if (cursor.peekNext() == '\n') { + cursor.next() + } + + continue + } else if (temp == "
") { + isQuote = false + + continue + } + + result = result + temp.prefixQuote(isQuote) + } + + result = result.replace("<", "<") + + return result.trim() } - fun String.truncateMarkdown(maxLength: Int = 1000): Pair { + fun String.prefixQuote(prefix: Boolean) = + if (prefix) { + split("\n") + .joinToString("\n") { + "> $it" + } + } else { + this + } + + fun String.truncateMarkdown(maxLength: Int = 3000): Pair { var result = this if (length > maxLength) { @@ -304,7 +403,7 @@ class MinecraftExtension : Extension() { return result to 0 } - private fun MessageBuilder.patchNotes(patchNote: PatchNote, maxLength: Int = 4000) { + private fun MessageBuilder.patchNotes(patchNote: PatchNote, maxLength: Int = 3000) { val (truncated, remaining) = patchNote.body.formatHTML().truncateMarkdown(maxLength) actionRow { @@ -335,14 +434,14 @@ class MinecraftExtension : Extension() { } } - private suspend fun TopGuildMessageChannel.relay(patchNote: PatchNote, maxLength: Int = 1000) { + private suspend fun TopGuildMessageChannel.relay(patchNote: PatchNote) { val message = createMessage { // If we are in the community guild, ping the update role if (guildId == COMMUNITY_GUILD) { content = "<@&$MINECRAFT_UPDATE_PING_ROLE>" } - patchNotes(patchNote, maxLength) + patchNotes(patchNote) } val title = if (patchNote.title.startsWith("minecraft ", true)) { @@ -368,7 +467,10 @@ class MinecraftExtension : Extension() { } } - private suspend fun PatchNoteEntry.get() = + fun getLatest() = + currentEntries.entries.first() + + suspend fun PatchNoteEntry.get() = client.get("$BASE_URL/$contentPath").body() @OptIn(KordPreview::class) @@ -378,4 +480,32 @@ class MinecraftExtension : Extension() { description = "Specific version to get patch notes for" } } + + @OptIn(KordPreview::class) + class UpdateArguments : Arguments() { + val version by string { + name = "version" + description = "Specific version to get patch notes for" + } + + val message by message { + name = "message" + description = "Message to edit with a new embed" + } + } +} + +// In-dev testing function +@Suppress("unused") +private suspend fun main() { + val ext = MinecraftExtension() + ext.populateVersions() + + val current = ext.getLatest() + + with(ext) { + println(current.get().body.formatHTML()) + } + + exitProcess(0) } diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/modhostverify/ModHostingVerificationExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/modhostverify/ModHostingVerificationExtension.kt index b7439adb..74cbcd9e 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/modhostverify/ModHostingVerificationExtension.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/modhostverify/ModHostingVerificationExtension.kt @@ -6,14 +6,6 @@ package org.quiltmc.community.modes.quilt.extensions.modhostverify -import com.kotlindiscord.kord.extensions.DISCORD_RED -import com.kotlindiscord.kord.extensions.checks.isNotBot -import com.kotlindiscord.kord.extensions.extensions.Extension -import com.kotlindiscord.kord.extensions.extensions.event -import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.events.PKMessageCreateEvent -import com.kotlindiscord.kord.extensions.utils.dm -import com.kotlindiscord.kord.extensions.utils.getParentMessage -import com.kotlindiscord.kord.extensions.utils.scheduling.Scheduler import dev.kord.common.entity.MessageType import dev.kord.core.behavior.channel.asChannelOf import dev.kord.core.behavior.channel.createEmbed @@ -26,6 +18,14 @@ import dev.kord.core.entity.User import dev.kord.core.entity.channel.TextChannel import dev.kord.rest.builder.message.create.MessageCreateBuilder import dev.kord.rest.builder.message.embed +import dev.kordex.core.DISCORD_RED +import dev.kordex.core.checks.isNotBot +import dev.kordex.core.extensions.Extension +import dev.kordex.core.extensions.event +import dev.kordex.core.utils.dm +import dev.kordex.core.utils.getParentMessage +import dev.kordex.core.utils.scheduling.Scheduler +import dev.kordex.modules.pluralkit.events.PKMessageCreateEvent import io.github.oshai.kotlinlogging.KotlinLogging import io.ktor.client.* import io.ktor.client.call.* diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/settings/SettingsExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/settings/SettingsExtension.kt index 684f7f6e..b0dafd81 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/settings/SettingsExtension.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/settings/SettingsExtension.kt @@ -8,23 +8,23 @@ package org.quiltmc.community.modes.quilt.extensions.settings -import com.kotlindiscord.kord.extensions.DISCORD_BLURPLE -import com.kotlindiscord.kord.extensions.checks.anyGuild -import com.kotlindiscord.kord.extensions.checks.hasPermission -import com.kotlindiscord.kord.extensions.checks.types.CheckContext -import com.kotlindiscord.kord.extensions.commands.Arguments -import com.kotlindiscord.kord.extensions.commands.application.slash.converters.impl.optionalEnumChoice -import com.kotlindiscord.kord.extensions.commands.application.slash.ephemeralSubCommand -import com.kotlindiscord.kord.extensions.commands.converters.impl.* -import com.kotlindiscord.kord.extensions.extensions.Extension -import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand -import com.kotlindiscord.kord.extensions.extensions.event import dev.kord.common.entity.Permission import dev.kord.core.Kord import dev.kord.core.entity.channel.Category import dev.kord.core.entity.channel.TopGuildMessageChannel import dev.kord.core.event.guild.GuildCreateEvent import dev.kord.rest.builder.message.embed +import dev.kordex.core.DISCORD_BLURPLE +import dev.kordex.core.checks.anyGuild +import dev.kordex.core.checks.hasPermission +import dev.kordex.core.checks.types.CheckContext +import dev.kordex.core.commands.Arguments +import dev.kordex.core.commands.application.slash.converters.impl.optionalEnumChoice +import dev.kordex.core.commands.application.slash.ephemeralSubCommand +import dev.kordex.core.commands.converters.impl.* +import dev.kordex.core.extensions.Extension +import dev.kordex.core.extensions.ephemeralSlashCommand +import dev.kordex.core.extensions.event import io.github.oshai.kotlinlogging.KotlinLogging import kotlinx.coroutines.delay import kotlinx.coroutines.launch diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/storage/BannedReactions.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/storage/BannedReactions.kt index bc7ca599..468e472a 100644 --- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/storage/BannedReactions.kt +++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/storage/BannedReactions.kt @@ -6,8 +6,8 @@ package org.quiltmc.community.modes.quilt.extensions.storage -import com.kotlindiscord.kord.extensions.storage.Data import dev.kord.common.entity.Snowflake +import dev.kordex.core.storage.Data import kotlinx.serialization.Serializable @Serializable diff --git a/src/main/resources/logback.groovy b/src/main/resources/logback.groovy index 561e6cac..bea8c5e6 100644 --- a/src/main/resources/logback.groovy +++ b/src/main/resources/logback.groovy @@ -4,8 +4,9 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import ch.qos.logback.core.joran.spi.ConsoleTarget +import ch.qos.logback.classic.Level import ch.qos.logback.core.ConsoleAppender +import ch.qos.logback.core.joran.spi.ConsoleTarget import org.quiltmc.community.DiscordLogAppender def environment = System.getenv("ENVIRONMENT") ?: "prod" diff --git a/src/main/resources/logbackCompiler.groovy b/src/main/resources/logbackCompiler.groovy index 44f5a931..c4e4a985 100644 --- a/src/main/resources/logbackCompiler.groovy +++ b/src/main/resources/logbackCompiler.groovy @@ -456,7 +456,7 @@ importsAcceptList = [ 'java.lang.System.getProperty', 'java.lang.System.getenv', 'java.util.Map.getOrDefault', - 'com.kotlindiscord.kord.extensions.utils._EnvironmentKt.envOrNull', + 'dev.kordex.core.utils._EnvironmentKt.envOrNull', 'org.quiltmc.community._ConstantsKt.getLOGGING_ENV', 'org.quiltmc.community._ConstantsKt.getLOGGING_URL' ]