Skip to content

Commit

Permalink
KordEx 2.2.0 updates, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
gdude2002 committed Aug 23, 2024
1 parent e0fc9e8 commit d397d12
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ dependencies {
implementation(gradleApi())
implementation(localGroovy())

implementation(kotlin("gradle-plugin", version = "2.0.20-RC2"))
implementation(kotlin("serialization", version = "2.0.20-RC2"))
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-RC2-1.0.24")
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")
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/cozy-module.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ plugins {
}

group = "org.quiltmc.community"
version = "1.0.1-SNAPSHOT"
version = "1.1.0-SNAPSHOT"

repositories {
maven {
Expand Down
5 changes: 1 addition & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
detekt = "1.23.6"
kotlin = "2.0.20-RC2"
kotlin = "2.0.20"
graphql = "7.1.4"

autolink = "0.11.0"
Expand All @@ -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"

Expand Down Expand Up @@ -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" }
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ 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.ExtensibleBotBuilder
import dev.kordex.core.builders.ExtensionsBuilder
import dev.kordex.core.components.ComponentContainer
import dev.kordex.core.components.components
import dev.kordex.core.components.ephemeralButton
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
package org.quiltmc.community.cozy.modules.logs

import com.unascribed.flexver.FlexVerComparator
import dev.kordex.core.builders.ExtensibleBotBuilder
import dev.kordex.core.builders.ExtensionsBuilder
import dev.kordex.core.utils.loadModule
import org.koin.dsl.bind
import org.nibor.autolink.LinkExtractor
Expand All @@ -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)
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

package org.quiltmc.community.cozy.modules.moderation

import dev.kordex.core.builders.ExtensibleBotBuilder
import dev.kordex.core.builders.ExtensionsBuilder
import kotlinx.datetime.Clock
import kotlinx.datetime.DateTimePeriod
import kotlinx.datetime.TimeZone.Companion.UTC
Expand All @@ -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))
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ 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.ExtensibleBotBuilder
import dev.kordex.core.builders.ExtensionsBuilder
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flatMapConcat
Expand All @@ -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<Kord>().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))
40 changes: 26 additions & 14 deletions src/main/kotlin/org/quiltmc/community/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ suspend fun setupCollab() = ExtensibleBot(DISCORD_TOKEN) {
database()

about {
name = "Cozy: Collab"
description = "Quilt's Discord bot, Community Collab edition."
addGeneral(
"Cozy: Collab",

"Quilt's Discord bot, Community Collab edition."
)
}

extensions {
Expand All @@ -69,10 +72,13 @@ suspend fun setupDev() = ExtensibleBot(DISCORD_TOKEN) {
database()

about {
name = "Cozy: Dev Tools"
description = "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."
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 {
Expand All @@ -92,10 +98,13 @@ suspend fun setupQuilt() = ExtensibleBot(DISCORD_TOKEN) {
settings()

about {
name = "Cozy: Community"
description = "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."
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 {
Expand Down Expand Up @@ -226,10 +235,13 @@ suspend fun setupShowcase() = ExtensibleBot(DISCORD_TOKEN) {
settings()

about {
name = "Cozy: Showcase"
description = "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."
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 {
Expand Down
63 changes: 53 additions & 10 deletions src/main/kotlin/org/quiltmc/community/_Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ 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
Expand Down Expand Up @@ -133,15 +138,22 @@ suspend fun ExtensibleBotBuilder.common() {
dataAdapter(::MongoDBDataAdapter)

about {
logoUrl = "https://github.com/QuiltMC/art/blob/master/misc/cozy-icons/original-raster/cozy-discord.png?raw=true"

sourceButton("https://github.com/QuiltMC/cozy-discord")
websiteButton("https://quiltmc.org/")
}

applicationCommands {
// Need to disable this due to the slash command perms experiment
// syncPermissions = false
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 {
Expand All @@ -165,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")
}
Expand Down Expand Up @@ -300,3 +312,34 @@ fun String.replaceParams(pairs: Map<String, Any>): 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"
}
}
}
}
}

0 comments on commit d397d12

Please sign in to comment.