diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index 1d601402..1cb65401 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -26,6 +26,11 @@
+
+
+
+
+
@@ -97,9 +102,9 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index 2b8a50fc..ae3f30ae 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
deleted file mode 100644
index 128cf299..00000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
index 839d1d52..90fee8e4 100644
--- a/README.md
+++ b/README.md
@@ -112,7 +112,7 @@ action {
val member = user.asMember(guild!!.id)
val roles = member.roles.toList().map { it.id }
if (MODERATOR_ROLES.any { it in roles }) {
- targetMessages.forEach { it.pin("Pinned by ${member.tag}") }
+ targetMessages.forEach { it.pin("Pinned by ${member.tagOrUsername()}") }
edit { content = "Messages pinned." }
return@action
}
@@ -120,7 +120,7 @@ action {
respond { content = "**Error:** This is not your thread." }
return@action
}
- targetMessages.forEach { it.pin("Pinned by ${member.tag}") }
+ targetMessages.forEach { it.pin("Pinned by ${member.tagOrUsername()}") }
edit { content = "Messages pinned." }
}
```
@@ -130,7 +130,7 @@ action {
if (this.member?.asMemberOrNull()?.mayManageRole(arguments.role) == true) {
arguments.targetUser.removeRole(
arguments.role.id,
- "${this.user.asUserOrNull()?.tag ?: this.user.id} used /team remove"
+ "${this.user.asUserOrNull()?.tagOrUsername() ?: this.user.id} used /team remove"
)
respond {
content = "Successfully removed ${arguments.targetUser.mention} from " +
@@ -166,7 +166,7 @@ action {
val roles = member.roles.toList().map { it.id }
if (MODERATOR_ROLES.any { it in roles }) {
- targetMessages.forEach { it.pin("Pinned by ${member.tag}") }
+ targetMessages.forEach { it.pin("Pinned by ${member.tagOrUsername()}") }
edit { content = "Messages pinned." }
return@action
@@ -178,7 +178,7 @@ action {
return@action
}
- targetMessages.forEach { it.pin("Pinned by ${member.tag}") }
+ targetMessages.forEach { it.pin("Pinned by ${member.tagOrUsername()}") }
edit { content = "Messages pinned." }
}
@@ -190,7 +190,7 @@ action {
arguments.targetUser.removeRole(
arguments.role.id,
- "${this.user.asUserOrNull()?.tag ?: this.user.id} used /team remove"
+ "${this.user.asUserOrNull()?.tagOrUsername() ?: this.user.id} used /team remove"
)
respond {
diff --git a/build.gradle.kts b/build.gradle.kts
index 2d358eda..821e93b0 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -87,13 +87,13 @@ dependencies {
implementation(libs.kx.ser)
implementation(libs.graphql)
- implementation(project(":module-ama"))
- implementation(project(":module-log-parser"))
- implementation(project(":module-moderation"))
- implementation(project(":module-role-sync"))
- implementation(project(":module-tags"))
- implementation(project(":module-user-cleanup"))
- implementation(project(":module-welcome"))
+ implementation(projects.moduleAma)
+ implementation(projects.moduleLogParser)
+ implementation(projects.moduleModeration)
+ implementation(projects.moduleRoleSync)
+ implementation(projects.moduleTags)
+ implementation(projects.moduleUserCleanup)
+ implementation(projects.moduleWelcome)
}
graphql {
@@ -107,7 +107,7 @@ graphql {
application {
// This is deprecated, but the Shadow plugin requires it
- mainClassName = "org.quiltmc.community.AppKt"
+ mainClass = "org.quiltmc.community.AppKt"
}
gitHooks {
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index 7b087c12..552fa42d 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -17,15 +17,15 @@ dependencies {
implementation(gradleApi())
implementation(localGroovy())
- implementation(kotlin("gradle-plugin", version = "1.8.0"))
- implementation(kotlin("serialization", version = "1.8.0"))
+ implementation(kotlin("gradle-plugin", version = "1.9.21"))
+ implementation(kotlin("serialization", version = "1.9.21"))
implementation("gradle.plugin.org.cadixdev.gradle", "licenser", "0.6.1")
implementation("com.github.jakemarsden", "git-hooks-gradle-plugin", "0.0.2")
- implementation("com.google.devtools.ksp", "com.google.devtools.ksp.gradle.plugin", "1.8.0-1.0.9")
- implementation("io.gitlab.arturbosch.detekt", "detekt-gradle-plugin", "1.22.0")
+ implementation("com.google.devtools.ksp", "com.google.devtools.ksp.gradle.plugin", "1.9.21-1.0.15")
+ implementation("io.gitlab.arturbosch.detekt", "detekt-gradle-plugin", "1.23.4")
implementation("org.ec4j.editorconfig", "org.ec4j.editorconfig.gradle.plugin", "0.0.3")
implementation("com.expediagroup.graphql", "com.expediagroup.graphql.gradle.plugin", "6.3.5")
- implementation("com.github.johnrengelman.shadow", "com.github.johnrengelman.shadow.gradle.plugin", "7.1.2")
+ implementation("com.github.johnrengelman.shadow", "com.github.johnrengelman.shadow.gradle.plugin", "8.1.1")
}
diff --git a/libs.versions.toml b/gradle/libs.versions.toml
similarity index 90%
rename from libs.versions.toml
rename to gradle/libs.versions.toml
index 483ded81..b5e0537c 100644
--- a/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,26 +1,26 @@
[versions]
-detekt = "1.22.0"
-kotlin = "1.8.0"
+detekt = "1.23.4"
+kotlin = "1.9.21"
graphql = "6.3.5"
autolink = "0.10.1"
commons-text = "1.10.0"
excelkt = "1.0.2"
-flexver = "1.1.0"
-groovy = "3.0.14"
+flexver = "1.1.1"
+groovy = "3.0.19"
homoglyph = "1.2.1"
-jansi = "2.4.0"
-jsoup = "1.15.3"
-kaml = "0.53.0"
+jansi = "2.4.1"
+jsoup = "1.17.1"
+kaml = "0.55.0"
kmongo = "4.8.0"
-kordex = "1.5.7-SNAPSHOT"
+kordex = "1.7.1-SNAPSHOT"
kotlintest = "3.4.2"
-ktor = "2.2.1"
-kx-ser = "1.4.1"
-logback = "1.4.5"
-logback-groovy = "1.14.0"
-logging = "2.1.23"
-moshi = "1.13.0"
+ktor = "2.2.4"
+kx-ser = "1.6.2"
+logback = "1.4.14"
+logback-groovy = "1.14.5"
+logging = "5.1.1"
+moshi = "1.15.0"
rgxgen = "1.4"
semver = "1.4.2"
@@ -54,7 +54,7 @@ ktor-content-negotiation = { module = "io.ktor:ktor-client-content-negotiation",
kx-ser = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kx-ser" }
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.microutils:kotlin-logging", version.ref = "logging" }
+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" }
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index f398c33c..3499ded5 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
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 253a1c3f..fc13c0f2 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
@@ -26,7 +26,6 @@ import com.kotlindiscord.kord.extensions.modules.unsafe.extensions.unsafeSlashCo
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 com.kotlindiscord.kord.extensions.types.respond
import dev.kord.common.entity.ButtonStyle
import dev.kord.common.entity.ChannelType
import dev.kord.common.entity.Permission
@@ -47,7 +46,7 @@ import dev.kord.core.entity.channel.Channel
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.create.embed
+import dev.kord.rest.builder.message.embed
import org.koin.core.component.inject
import org.quiltmc.community.cozy.modules.ama.data.AmaConfig
import org.quiltmc.community.cozy.modules.ama.data.AmaData
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 b037a3e6..13829db5 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
@@ -15,6 +15,7 @@ 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 com.kotlindiscord.kord.extensions.utils.tagOrUsername
import dev.kord.common.Color
import dev.kord.common.entity.ButtonStyle
import dev.kord.common.entity.Snowflake
@@ -25,8 +26,7 @@ import dev.kord.core.entity.Message
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.create.embed
-import dev.kord.rest.builder.message.modify.embed
+import dev.kord.rest.builder.message.embed
import kotlinx.serialization.KSerializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
@@ -49,7 +49,7 @@ public val User.uniqueName: String
"@${this.username}"
} else {
// Still using name#discrim system
- this.tag
+ this.tagOrUsername()
}
public fun EmbedBuilder.questionEmbed(
@@ -383,7 +383,7 @@ public suspend inline fun ComponentContainer.answeringButtons(
check {
if (event.interaction.user != claimer) {
- fail("You did not claim this question! ${claimer.tag} did")
+ fail("You did not claim this question! ${claimer.tagOrUsername()} did")
}
}
@@ -407,7 +407,7 @@ public suspend inline fun ComponentContainer.answeringButtons(
style = ButtonStyle.Success
check {
if (event.interaction.user != claimer) {
- fail("You did not claim the question! ${claimer.tag} did")
+ fail("You did not claim the question! ${claimer.tagOrUsername()} did")
}
}
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 54bbcbc4..03bcaf04 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
@@ -20,14 +20,14 @@ 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.create.embed
+import dev.kord.rest.builder.message.embed
+import io.github.oshai.kotlinlogging.KLogger
+import io.github.oshai.kotlinlogging.KotlinLogging
import io.ktor.client.*
import io.ktor.client.engine.cio.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
import kotlinx.serialization.decodeFromString
-import mu.KLogger
-import mu.KotlinLogging
import org.koin.core.component.inject
import org.quiltmc.community.cozy.modules.logs.config.LogParserConfig
import org.quiltmc.community.cozy.modules.logs.data.Log
@@ -289,6 +289,9 @@ public class LogParserExtension : Extension() {
}
}
+ if (embeds == null) embeds = mutableListOf()
+ val embeds = embeds!!
+
if (embeds.size > 10) {
val extraEmbeds = embeds.size - 10
val allEmbeds = embeds.take(10)
diff --git a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/parsers/LauncherParser.kt b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/parsers/LauncherParser.kt
index 4c9e2b52..1f65061e 100644
--- a/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/parsers/LauncherParser.kt
+++ b/module-log-parser/src/main/kotlin/org/quiltmc/community/cozy/modules/logs/parsers/LauncherParser.kt
@@ -32,7 +32,7 @@ public class LauncherParser : LogParser() {
override suspend fun process(log: Log) {
val (launcher, match) = PATTERNS.entries
.map { (launcher, pattern) -> Pair(launcher, pattern.find(log.content)) }
- .firstOrNull() { (_, match) -> match != null }
+ .firstOrNull { (_, match) -> match != null }
?: return
log.launcher = Launcher(launcher, match!!.groups[1]?.value)
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 460a03ac..65a62eaf 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
@@ -14,18 +14,17 @@ 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.*
+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.types.respond
-import com.kotlindiscord.kord.extensions.utils.deleteIgnoringNotFound
-import com.kotlindiscord.kord.extensions.utils.removeTimeout
-import com.kotlindiscord.kord.extensions.utils.respond
-import com.kotlindiscord.kord.extensions.utils.timeout
+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,7 +32,7 @@ import dev.kord.core.entity.Member
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.create.embed
+import dev.kord.rest.builder.message.embed
import kotlinx.coroutines.flow.filterIsInstance
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.withTimeoutOrNull
@@ -129,11 +128,11 @@ public class ModerationExtension(
if (event.pkMessage.system != null) {
append(event.pkMessage.system?.tag ?: "(${event.pkMessage.system?.id})")
} else {
- append("(${event.author.displayName})")
+ append("(${event.author.globalName})")
}
}
} else {
- event.author!!.displayName
+ event.author!!.globalName
}
icon = if (event is ProxiedMessageCreateEvent && event.pkMessage.member != null) {
@@ -164,7 +163,7 @@ public class ModerationExtension(
if (arguments.duration != null) {
arguments.user.timeout(
arguments.duration!!,
- reason = "Timed out by ${user.asUser().tag}: $reason"
+ reason = "Timed out by ${user.asUser().tagOrUsername()}: $reason"
)
respond {
@@ -172,7 +171,7 @@ public class ModerationExtension(
}
} else {
arguments.user.removeTimeout(
- reason = "Timeout removed by ${user.asUser().tag}: $reason"
+ reason = "Timeout removed by ${user.asUser().tagOrUsername()}: $reason"
)
respond {
@@ -282,7 +281,7 @@ public class ModerationExtension(
if (arguments.duration != null) {
arguments.user.timeout(
arguments.duration!!,
- reason = "Timed out by ${user?.asUser()?.tag}: $reason"
+ reason = "Timed out by ${user?.asUser()?.tagOrUsername()}: $reason"
)
message.respond {
@@ -290,7 +289,7 @@ public class ModerationExtension(
}
} else {
arguments.user.removeTimeout(
- reason = "Timeout removed by ${user?.asUser()?.tag}: $reason"
+ reason = "Timeout removed by ${user?.asUser()?.tagOrUsername()}: $reason"
)
message.respond {
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 15cf064f..cd4c4993 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
@@ -10,7 +10,6 @@ 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.types.respond
import com.kotlindiscord.kord.extensions.utils.hasRole
import dev.kord.core.event.guild.MemberJoinEvent
import dev.kord.core.event.guild.MemberUpdateEvent
@@ -74,7 +73,7 @@ public class RoleSyncExtension(
}
}
- ephemeralSlashCommand() {
+ ephemeralSlashCommand {
name = "role-sync"
description = "Manually sync roles"
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 7c077822..a485bcf5 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
@@ -11,13 +11,13 @@ 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 kotlinx.coroutines.FlowPreview
+import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flatMapConcat
import org.quiltmc.community.cozy.modules.rolesync.config.RoleSyncConfig
import org.quiltmc.community.cozy.modules.rolesync.config.SimpleRoleSyncConfig
-@OptIn(FlowPreview::class)
+@OptIn(ExperimentalCoroutinesApi::class)
public suspend fun getGuildForRoleSnowflake(roleId: Snowflake, bot: ExtensibleBot): Role =
bot.getKoin().get().guilds.flatMapConcat { it.roles }.first { it.id == roleId }
diff --git a/module-tags/src/main/kotlin/org/quiltmc/community/cozy/modules/tags/TagsExtension.kt b/module-tags/src/main/kotlin/org/quiltmc/community/cozy/modules/tags/TagsExtension.kt
index fd8a5a95..8f13bd03 100644
--- a/module-tags/src/main/kotlin/org/quiltmc/community/cozy/modules/tags/TagsExtension.kt
+++ b/module-tags/src/main/kotlin/org/quiltmc/community/cozy/modules/tags/TagsExtension.kt
@@ -19,15 +19,13 @@ import com.kotlindiscord.kord.extensions.modules.unsafe.extensions.unsafeSubComm
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 com.kotlindiscord.kord.extensions.types.editingPaginator
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.FilterStrategy
import com.kotlindiscord.kord.extensions.utils.suggestStringMap
import dev.kord.common.annotation.KordUnsafe
import dev.kord.core.behavior.channel.createMessage
import dev.kord.core.behavior.interaction.modal
import dev.kord.core.behavior.interaction.suggestString
-import dev.kord.rest.builder.message.create.allowedMentions
+import dev.kord.rest.builder.message.allowedMentions
import org.koin.core.component.inject
import org.quiltmc.community.cozy.modules.tags.config.TagsConfig
import org.quiltmc.community.cozy.modules.tags.data.Tag
diff --git a/module-tags/src/main/kotlin/org/quiltmc/community/cozy/modules/tags/config/SimpleTagsConfig.kt b/module-tags/src/main/kotlin/org/quiltmc/community/cozy/modules/tags/config/SimpleTagsConfig.kt
index c7b1e44d..f6686eca 100644
--- a/module-tags/src/main/kotlin/org/quiltmc/community/cozy/modules/tags/config/SimpleTagsConfig.kt
+++ b/module-tags/src/main/kotlin/org/quiltmc/community/cozy/modules/tags/config/SimpleTagsConfig.kt
@@ -9,7 +9,7 @@ package org.quiltmc.community.cozy.modules.tags.config
import com.kotlindiscord.kord.extensions.checks.types.Check
import dev.kord.core.entity.Guild
import dev.kord.core.entity.channel.GuildMessageChannel
-import dev.kord.rest.builder.message.create.embed
+import dev.kord.rest.builder.message.embed
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.filterIsInstance
import kotlinx.coroutines.flow.lastOrNull
diff --git a/module-user-cleanup/src/main/kotlin/org/quiltmc/community/cozy/modules/cleanup/UserCleanupExtension.kt b/module-user-cleanup/src/main/kotlin/org/quiltmc/community/cozy/modules/cleanup/UserCleanupExtension.kt
index c60c1e60..de30d015 100644
--- a/module-user-cleanup/src/main/kotlin/org/quiltmc/community/cozy/modules/cleanup/UserCleanupExtension.kt
+++ b/module-user-cleanup/src/main/kotlin/org/quiltmc/community/cozy/modules/cleanup/UserCleanupExtension.kt
@@ -16,20 +16,19 @@ import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
import com.kotlindiscord.kord.extensions.time.TimestampType
import com.kotlindiscord.kord.extensions.time.toDiscord
-import com.kotlindiscord.kord.extensions.types.editingPaginator
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.scheduling.Scheduler
import com.kotlindiscord.kord.extensions.utils.scheduling.Task
+import com.kotlindiscord.kord.extensions.utils.tagOrUsername
import dev.kord.core.behavior.channel.createMessage
import dev.kord.core.entity.Guild
import dev.kord.core.entity.Member
+import io.github.oshai.kotlinlogging.KotlinLogging
import io.ktor.client.request.forms.*
import io.ktor.utils.io.jvm.javaio.*
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.toList
import kotlinx.datetime.Clock
import kotlinx.datetime.toJavaInstant
-import mu.KotlinLogging
import org.quiltmc.community.cozy.modules.cleanup.config.UserCleanupConfig
import java.time.ZoneId
import java.time.format.DateTimeFormatter
@@ -107,7 +106,7 @@ public class UserCleanupExtension(
description = "**Mention** | **Tag** | **Join date**\n\n"
chunk.forEach { member ->
- description += "${member.mention} | ${member.tag} |" +
+ description += "${member.mention} | ${member.tagOrUsername()} |" +
"${member.joinedAt.toDiscord(TimestampType.Default)}\n"
}
}
@@ -152,7 +151,7 @@ public class UserCleanupExtension(
"| ------- | --- | --------------- |\n" +
removed.joinToString("\n") {
- "| ${it.id} | ${it.tag} | ${instantFormatter.format(it.joinedAt.toJavaInstant())} |"
+ "| ${it.id} | ${it.tagOrUsername()} | ${instantFormatter.format(it.joinedAt.toJavaInstant())} |"
}
config.getLoggingChannel(guild).createMessage {
diff --git a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/WelcomeChannel.kt b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/WelcomeChannel.kt
index 456d3da4..565aef55 100644
--- a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/WelcomeChannel.kt
+++ b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/WelcomeChannel.kt
@@ -25,10 +25,9 @@ import dev.kord.core.entity.Message
import dev.kord.core.entity.channel.GuildMessageChannel
import dev.kord.core.event.interaction.InteractionCreateEvent
import dev.kord.core.supplier.EntitySupplyStrategy
+import dev.kord.rest.builder.message.allowedMentions
import dev.kord.rest.builder.message.create.UserMessageCreateBuilder
-import dev.kord.rest.builder.message.create.allowedMentions
-import dev.kord.rest.builder.message.create.embed
-import dev.kord.rest.builder.message.modify.allowedMentions
+import dev.kord.rest.builder.message.embed
import dev.kord.rest.request.RestRequestException
import io.ktor.client.*
import io.ktor.client.call.*
diff --git a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/WelcomeExtension.kt b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/WelcomeExtension.kt
index f5297fb6..2777a8ed 100644
--- a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/WelcomeExtension.kt
+++ b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/WelcomeExtension.kt
@@ -15,7 +15,7 @@ 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.types.respond
+import com.kotlindiscord.kord.extensions.utils.tagOrUsername
import dev.kord.common.entity.Snowflake
import dev.kord.core.behavior.channel.asChannelOf
import dev.kord.core.behavior.channel.asChannelOfOrNull
@@ -25,7 +25,7 @@ import dev.kord.core.entity.channel.GuildMessageChannel
import dev.kord.core.event.guild.GuildCreateEvent
import dev.kord.core.event.interaction.InteractionCreateEvent
import dev.kord.rest.builder.message.create.UserMessageCreateBuilder
-import dev.kord.rest.builder.message.create.embed
+import dev.kord.rest.builder.message.embed
import kotlinx.coroutines.flow.toList
import org.koin.core.component.inject
import org.quiltmc.community.cozy.modules.welcome.config.WelcomeChannelConfig
@@ -142,7 +142,7 @@ public class WelcomeExtension : Extension() {
name = "Staff Member"
value = "${user.mention} (" +
"`${user.id}` / " +
- "`${user.asUser().tag}`" +
+ "`${user.asUser().tagOrUsername()}`" +
")"
}
}
@@ -217,7 +217,7 @@ public class WelcomeExtension : Extension() {
name = "Staff Member"
value = "${user.mention} (" +
"`${user.id}` / " +
- "`${user.asUser().tag}`" +
+ "`${user.asUser().tagOrUsername()}`" +
")"
}
}
@@ -286,7 +286,7 @@ public class WelcomeExtension : Extension() {
name = "Staff Member"
value = "${user.mention} (" +
"`${user.id}` / " +
- "`${user.asUser().tag}`" +
+ "`${user.asUser().tagOrUsername()}`" +
")"
}
}
diff --git a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/_Utils.kt b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/_Utils.kt
index 7ffee36c..6d97f32d 100644
--- a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/_Utils.kt
+++ b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/_Utils.kt
@@ -51,10 +51,10 @@ public inline fun List.ifNotEmpty(body: (Collection
public fun MessageCreateBuilder.isSimilar(other: Message): Boolean {
val builderComponents = components
- .mapNotNull { it.build().components.value }
- .ifNotEmpty {
+ ?.mapNotNull { it.build().components.value }
+ ?.ifNotEmpty {
reduce { left, right -> left + right }
- }
+ } ?: emptyList()
val messageComponents = other.actionRows
.map { it.components }
@@ -75,14 +75,14 @@ public fun MessageCreateBuilder.isSimilar(other: Message): Boolean {
}
return content == other.content &&
- embeds.size == messageEmbedBuilders.size &&
+ embeds?.size == messageEmbedBuilders.size &&
componentsAreSimilar(builderComponents, messageComponents) &&
- embeds.filterIndexed { index, embed ->
+ embeds?.filterIndexed { index, embed ->
val otherEmbed = messageEmbedBuilders[index]
embed.isSimilar(otherEmbed)
- }.size == embeds.size
+ }?.size == embeds?.size
}
public fun componentsAreSimilar(
diff --git a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/ComplianceBlock.kt b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/ComplianceBlock.kt
index 120d5980..b89a1aa7 100644
--- a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/ComplianceBlock.kt
+++ b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/ComplianceBlock.kt
@@ -10,6 +10,7 @@ package org.quiltmc.community.cozy.modules.welcome.blocks
import com.kotlindiscord.kord.extensions.DISCORD_BLURPLE
import com.kotlindiscord.kord.extensions.koin.KordExKoinComponent
+import com.kotlindiscord.kord.extensions.utils.tagOrUsername
import dev.kord.common.entity.ButtonStyle
import dev.kord.common.entity.Snowflake
import dev.kord.core.Kord
@@ -21,12 +22,10 @@ import dev.kord.core.entity.Role
import dev.kord.core.entity.channel.TextChannel
import dev.kord.core.event.interaction.ButtonInteractionCreateEvent
import dev.kord.core.event.interaction.InteractionCreateEvent
+import dev.kord.rest.builder.message.actionRow
+import dev.kord.rest.builder.message.allowedMentions
import dev.kord.rest.builder.message.create.MessageCreateBuilder
-import dev.kord.rest.builder.message.create.actionRow
-import dev.kord.rest.builder.message.create.allowedMentions
import dev.kord.rest.builder.message.modify.MessageModifyBuilder
-import dev.kord.rest.builder.message.modify.actionRow
-import dev.kord.rest.builder.message.modify.allowedMentions
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.datetime.Clock
import kotlinx.serialization.SerialName
@@ -135,7 +134,7 @@ public data class ComplianceBlock(
inline = true
name = "User"
- value = "${user.mention} (`${user.tag}` / `${user.id}`)"
+ value = "${user.mention} (`${user.tagOrUsername()}` / `${user.id}`)"
}
}
diff --git a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/EmbedBlock.kt b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/EmbedBlock.kt
index e138aa4a..dbb7654f 100644
--- a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/EmbedBlock.kt
+++ b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/EmbedBlock.kt
@@ -11,9 +11,8 @@ import dev.kord.core.Kord
import dev.kord.core.cache.data.EmbedData
import dev.kord.core.entity.Embed
import dev.kord.rest.builder.message.create.MessageCreateBuilder
-import dev.kord.rest.builder.message.create.embed
+import dev.kord.rest.builder.message.embed
import dev.kord.rest.builder.message.modify.MessageModifyBuilder
-import dev.kord.rest.builder.message.modify.embed
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import org.koin.core.component.inject
diff --git a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/LinksBlock.kt b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/LinksBlock.kt
index fc719426..dd46049b 100644
--- a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/LinksBlock.kt
+++ b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/LinksBlock.kt
@@ -9,9 +9,8 @@ package org.quiltmc.community.cozy.modules.welcome.blocks
import com.kotlindiscord.kord.extensions.DISCORD_BLURPLE
import dev.kord.common.Color
import dev.kord.rest.builder.message.create.MessageCreateBuilder
-import dev.kord.rest.builder.message.create.embed
+import dev.kord.rest.builder.message.embed
import dev.kord.rest.builder.message.modify.MessageModifyBuilder
-import dev.kord.rest.builder.message.modify.embed
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
diff --git a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/MessageCopyBlock.kt b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/MessageCopyBlock.kt
index b9dc9bb1..d85bb783 100644
--- a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/MessageCopyBlock.kt
+++ b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/MessageCopyBlock.kt
@@ -15,9 +15,8 @@ import dev.kord.core.behavior.getChannelOfOrNull
import dev.kord.core.entity.Message
import dev.kord.core.entity.channel.GuildMessageChannel
import dev.kord.rest.builder.message.create.MessageCreateBuilder
-import dev.kord.rest.builder.message.create.embed
+import dev.kord.rest.builder.message.embed
import dev.kord.rest.builder.message.modify.MessageModifyBuilder
-import dev.kord.rest.builder.message.modify.embed
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import org.koin.core.component.inject
diff --git a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/RolesBlock.kt b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/RolesBlock.kt
index bb75e938..a9b82b1e 100644
--- a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/RolesBlock.kt
+++ b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/RolesBlock.kt
@@ -24,12 +24,10 @@ import dev.kord.core.event.interaction.InteractionCreateEvent
import dev.kord.core.event.interaction.SelectMenuInteractionCreateEvent
import dev.kord.rest.builder.component.option
import dev.kord.rest.builder.message.EmbedBuilder
+import dev.kord.rest.builder.message.actionRow
import dev.kord.rest.builder.message.create.MessageCreateBuilder
-import dev.kord.rest.builder.message.create.actionRow
-import dev.kord.rest.builder.message.create.embed
+import dev.kord.rest.builder.message.embed
import dev.kord.rest.builder.message.modify.MessageModifyBuilder
-import dev.kord.rest.builder.message.modify.actionRow
-import dev.kord.rest.builder.message.modify.embed
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.toList
import kotlinx.serialization.SerialName
diff --git a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/RulesBlock.kt b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/RulesBlock.kt
index 562e7010..ea863c27 100644
--- a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/RulesBlock.kt
+++ b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/RulesBlock.kt
@@ -8,9 +8,8 @@ package org.quiltmc.community.cozy.modules.welcome.blocks
import dev.kord.common.Color
import dev.kord.rest.builder.message.create.MessageCreateBuilder
-import dev.kord.rest.builder.message.create.embed
+import dev.kord.rest.builder.message.embed
import dev.kord.rest.builder.message.modify.MessageModifyBuilder
-import dev.kord.rest.builder.message.modify.embed
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
diff --git a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/ThreadListBlock.kt b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/ThreadListBlock.kt
index b9e5af77..34fedc42 100644
--- a/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/ThreadListBlock.kt
+++ b/module-welcome/src/main/kotlin/org/quiltmc/community/cozy/modules/welcome/blocks/ThreadListBlock.kt
@@ -17,9 +17,8 @@ import dev.kord.core.entity.channel.TextChannel
import dev.kord.core.entity.channel.thread.ThreadChannel
import dev.kord.rest.builder.message.EmbedBuilder
import dev.kord.rest.builder.message.create.MessageCreateBuilder
-import dev.kord.rest.builder.message.create.embed
+import dev.kord.rest.builder.message.embed
import dev.kord.rest.builder.message.modify.MessageModifyBuilder
-import dev.kord.rest.builder.message.modify.embed
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.toList
import kotlinx.serialization.SerialName
diff --git a/settings.gradle.kts b/settings.gradle.kts
index e13092e7..bfd2fb8a 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -13,15 +13,7 @@ pluginManagement {
rootProject.name = "CozyDiscord"
-enableFeaturePreview("VERSION_CATALOGS")
-
-dependencyResolutionManagement {
- versionCatalogs {
- create("libs") {
- from(files("libs.versions.toml"))
- }
- }
-}
+enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
include(":module-log-parser")
include(":module-moderation")
diff --git a/src/main/kotlin/org/quiltmc/community/App.kt b/src/main/kotlin/org/quiltmc/community/App.kt
index a9d58377..4f51311d 100644
--- a/src/main/kotlin/org/quiltmc/community/App.kt
+++ b/src/main/kotlin/org/quiltmc/community/App.kt
@@ -6,9 +6,6 @@
@file:OptIn(PrivilegedIntent::class)
-/*
- * This Kotlin source file was generated by the Gradle 'init' task.
- */
package org.quiltmc.community
import com.kotlindiscord.kord.extensions.ExtensibleBot
@@ -20,6 +17,7 @@ import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.extPluralKit
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 kotlinx.coroutines.flow.filter
@@ -93,7 +91,7 @@ suspend fun setupQuilt() = ExtensibleBot(DISCORD_TOKEN) {
}
intents {
- +Intents.all
+ +Intents.ALL
}
members {
diff --git a/src/main/kotlin/org/quiltmc/community/DiscordLogAppender.kt b/src/main/kotlin/org/quiltmc/community/DiscordLogAppender.kt
index 6f89b47c..4f9a03b8 100644
--- a/src/main/kotlin/org/quiltmc/community/DiscordLogAppender.kt
+++ b/src/main/kotlin/org/quiltmc/community/DiscordLogAppender.kt
@@ -21,15 +21,9 @@ import dev.kord.common.entity.Snowflake
import dev.kord.core.Kord
import dev.kord.core.behavior.WebhookBehavior
import dev.kord.core.behavior.execute
-import dev.kord.rest.builder.message.create.embed
-import io.ktor.client.*
-import io.ktor.client.engine.cio.*
-import io.ktor.client.plugins.contentnegotiation.*
-import io.ktor.client.request.*
-import io.ktor.http.*
-import io.ktor.serialization.kotlinx.json.*
+import dev.kord.rest.builder.message.embed
+import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.datetime.Instant
-import mu.KotlinLogging
import org.koin.core.component.inject
class DiscordLogAppender : AppenderBase(), KordExKoinComponent {
diff --git a/src/main/kotlin/org/quiltmc/community/_Checks.kt b/src/main/kotlin/org/quiltmc/community/_Checks.kt
index 604e5461..2ebb9d7d 100644
--- a/src/main/kotlin/org/quiltmc/community/_Checks.kt
+++ b/src/main/kotlin/org/quiltmc/community/_Checks.kt
@@ -13,7 +13,7 @@ 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 mu.KotlinLogging
+import io.github.oshai.kotlinlogging.KotlinLogging
import org.quiltmc.community.database.collections.ServerSettingsCollection
suspend fun CheckContext<*>.notInStaffChannel() {
diff --git a/src/main/kotlin/org/quiltmc/community/_Utils.kt b/src/main/kotlin/org/quiltmc/community/_Utils.kt
index df746d33..ef38315a 100644
--- a/src/main/kotlin/org/quiltmc/community/_Utils.kt
+++ b/src/main/kotlin/org/quiltmc/community/_Utils.kt
@@ -10,10 +10,7 @@ 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 com.kotlindiscord.kord.extensions.utils.*
import dev.kord.common.entity.ArchiveDuration
import dev.kord.common.entity.Snowflake
import dev.kord.common.entity.UserFlag
@@ -135,7 +132,7 @@ suspend fun ExtensibleBotBuilder.common() {
applicationCommands {
// Need to disable this due to the slash command perms experiment
- syncPermissions = false
+// syncPermissions = false
}
extensions {
@@ -217,7 +214,7 @@ suspend fun Guild.getFilterLogChannel(): GuildMessageChannel? {
suspend fun EmbedBuilder.userField(user: UserBehavior, role: String? = null, inline: Boolean = false) {
field {
name = role ?: "User"
- value = "${user.mention} (`${user.id}` / `${user.asUser().tag}`)"
+ value = "${user.mention} (`${user.id}` / `${user.asUser().tagOrUsername()}`)"
this.inline = inline
}
@@ -258,6 +255,7 @@ fun Message.contentToThreadName(fallbackPrefix: String): String {
?: "$fallbackPrefix | $id"
}
+@Suppress("DEPRECATION_ERROR") // Either this, or the when block needs an else branch
fun UserFlag.getName(): String = when (this) {
UserFlag.ActiveDeveloper -> "Active Developer"
UserFlag.BotHttpInteractions -> "HTTP-Based Commands"
@@ -275,6 +273,7 @@ fun UserFlag.getName(): String = when (this) {
UserFlag.TeamUser -> "Team User"
UserFlag.VerifiedBot -> "Verified Bot"
UserFlag.VerifiedBotDeveloper -> "Early Verified Bot Developer"
+ is UserFlag.Unknown -> "Unknown"
}
fun String.replaceParams(vararg pairs: Pair): String {
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 2b428b68..80d0b287 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
@@ -16,12 +16,11 @@ 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.types.editingPaginator
-import com.kotlindiscord.kord.extensions.types.respond
+import com.kotlindiscord.kord.extensions.utils.tagOrUsername
import com.kotlindiscord.kord.extensions.utils.translate
import dev.kord.common.entity.Snowflake
import dev.kord.rest.Image
-import dev.kord.rest.builder.message.create.embed
+import dev.kord.rest.builder.message.embed
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.plugins.*
@@ -69,14 +68,14 @@ class LookupExtension : Extension() {
return@action
}
- val flags = user.publicFlags?.flags ?: listOf()
+ val flags = user.publicFlags?.values ?: listOf()
respond {
embed {
color = DISCORD_BLURPLE
description = "**__Basic Information__**\n" +
- "**Tag:** `${user.tag}`\n" +
+ "**Tag:** `${user.tagOrUsername()}`\n" +
"**ID:** `${user.id.value}`\n" +
"**Mention:** ${user.mention}\n\n" +
@@ -92,13 +91,13 @@ class LookupExtension : Extension() {
if (flags.isNotEmpty()) {
"(${flags.size})\n" +
- flags.joinToString(", ") { it.name }
+ flags.joinToString(", ") { it.getName() }
} else {
"\nNo flags."
}
author {
- name = user.tag
+ name = user.tagOrUsername()
icon = user.avatar?.cdnUrl?.toUrl()
}
@@ -266,11 +265,11 @@ class LookupExtension : Extension() {
builder.append("**Mention:** ${channel?.mention}\n\n")
if (user != null) {
- val flags = user.publicFlags?.flags ?: listOf()
+ val flags = user.publicFlags?.values ?: listOf()
builder.append(
"**__Inviter Information__**\n" +
- "**Tag:** `${user.tag}`\n" +
+ "**Tag:** `${user.tagOrUsername()}`\n" +
"**ID:** `${user.id.value}`\n" +
"**Mention:** ${user.mention}\n\n" +
diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/ApplicationsExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/ApplicationsExtension.kt
index 0d1db297..491a6540 100644
--- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/ApplicationsExtension.kt
+++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/ApplicationsExtension.kt
@@ -20,8 +20,6 @@ import com.kotlindiscord.kord.extensions.events.extra.models.GuildJoinRequestRes
import com.kotlindiscord.kord.extensions.extensions.*
import com.kotlindiscord.kord.extensions.time.TimestampType
import com.kotlindiscord.kord.extensions.time.toDiscord
-import com.kotlindiscord.kord.extensions.types.editingPaginator
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.*
import dev.kord.common.Color
import dev.kord.common.entity.ButtonStyle
@@ -39,15 +37,13 @@ import dev.kord.core.entity.channel.TextChannel
import dev.kord.core.entity.channel.TopGuildMessageChannel
import dev.kord.core.event.interaction.ButtonInteractionCreateEvent
import dev.kord.rest.builder.message.EmbedBuilder
-import dev.kord.rest.builder.message.create.actionRow
-import dev.kord.rest.builder.message.create.embed
-import dev.kord.rest.builder.message.modify.actionRow
-import dev.kord.rest.builder.message.modify.embed
+import dev.kord.rest.builder.message.actionRow
+import dev.kord.rest.builder.message.embed
+import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.toList
import kotlinx.datetime.Instant
-import mu.KotlinLogging
import org.koin.core.component.inject
import org.quiltmc.community.GUILDS
import org.quiltmc.community.database.collections.ServerApplicationCollection
@@ -137,13 +133,13 @@ class ApplicationsExtension : Extension() {
field {
inline = true
name = "Moderator"
- value = "${user.asUser().tag} (${user.mention})"
+ value = "${user.asUser().tagOrUsername()} (${user.mention})"
}
field {
inline = true
name = "User"
- value = "${member.tag} (${member.mention})"
+ value = "${member.tagOrUsername()} (${member.mention})"
}
}
@@ -334,13 +330,13 @@ class ApplicationsExtension : Extension() {
field {
inline = true
name = "Moderator"
- value = "${user!!.asUser().tag} (${user!!.mention})"
+ value = "${user!!.asUser().tagOrUsername()} (${user!!.mention})"
}
field {
inline = true
name = "User"
- value = "${member.tag} (${member.mention})"
+ value = "${member.tagOrUsername()} (${member.mention})"
}
}
@@ -435,7 +431,7 @@ class ApplicationsExtension : Extension() {
// Not actually deprecated, Kord walled themselves into a hole here
@Suppress("DEPRECATION_ERROR")
- val thread = threadChannel.startPrivateThread("App: ${user.tag}")
+ val thread = threadChannel.startPrivateThread("App: ${user.tagOrUsername()}")
val initialMessage = thread.createMessage("Better get the mods in...")
initialMessage.edit { content = settings.moderatorRoles.joinToString { "<@&$it>" } }
@@ -443,7 +439,7 @@ class ApplicationsExtension : Extension() {
initialMessage.edit {
content = buildString {
- appendLine("**Application thread for ${user.tag}**")
+ appendLine("**Application thread for ${user.tagOrUsername()}**")
append("User ID below.")
}
}
@@ -507,13 +503,13 @@ class ApplicationsExtension : Extension() {
field {
inline = true
name = "Moderator"
- value = "${event.interaction.user.tag} (${event.interaction.user.mention})"
+ value = "${event.interaction.user.tagOrUsername()} (${event.interaction.user.mention})"
}
field {
inline = true
name = "User"
- value = "${member.tag} (${member.mention})"
+ value = "${member.tagOrUsername()} (${member.mention})"
}
}
@@ -790,7 +786,7 @@ class ApplicationsExtension : Extension() {
title = "Application (${event.request.status.name.capitalizeWords()})"
description = buildString {
- appendLine("**User:** ${user.tag}")
+ appendLine("**User:** ${user.tagOrUsername()}")
appendLine("**Mention:** ${user.mention}")
appendLine(
"**Created:** ${user.id.timestamp.longAndRelative}"
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 fee184d4..16384419 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
@@ -28,7 +28,6 @@ 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.types.respond
import com.kotlindiscord.kord.extensions.utils.addReaction
import com.kotlindiscord.kord.extensions.utils.deleteOwnReaction
import com.kotlindiscord.kord.extensions.utils.ensureWebhook
diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/PKExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/PKExtension.kt
index 1240716f..ada1d987 100644
--- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/PKExtension.kt
+++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/PKExtension.kt
@@ -12,7 +12,7 @@ import com.kotlindiscord.kord.extensions.extensions.event
import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.events.ProxiedMessageCreateEvent
import com.kotlindiscord.kord.extensions.utils.getJumpUrl
import dev.kord.core.behavior.channel.createMessage
-import dev.kord.rest.builder.message.create.embed
+import dev.kord.rest.builder.message.embed
import org.koin.core.component.inject
import org.quiltmc.community.database.collections.ServerSettingsCollection
import org.quiltmc.community.database.collections.UserFlagsCollection
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 28fd99cb..0010158f 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,7 +8,10 @@
package org.quiltmc.community.modes.quilt.extensions
-import com.kotlindiscord.kord.extensions.checks.*
+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
@@ -21,10 +24,10 @@ import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.events.PKMessag
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.types.respond
import com.kotlindiscord.kord.extensions.utils.authorId
import com.kotlindiscord.kord.extensions.utils.capitalizeWords
import com.kotlindiscord.kord.extensions.utils.dm
+import com.kotlindiscord.kord.extensions.utils.tagOrUsername
import dev.kord.common.entity.ChannelType
import dev.kord.common.entity.MessageType
import dev.kord.common.entity.Permission
@@ -119,7 +122,7 @@ class ShowcaseExtension : Extension() {
val thread = channel.startPublicThreadWithMessage(
event.message.id, title
- ) { reason = "Showcase thread created for ${event.message.author?.tag}" }
+ ) { reason = "Showcase thread created for ${event.message.author?.tagOrUsername()}" }
threads.set(
OwnedThread(thread.id, authorId, guild.id)
diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/SubteamsExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/SubteamsExtension.kt
index df65893f..8aa7c8a5 100644
--- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/SubteamsExtension.kt
+++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/SubteamsExtension.kt
@@ -14,11 +14,11 @@ import com.kotlindiscord.kord.extensions.commands.converters.impl.member
import com.kotlindiscord.kord.extensions.commands.converters.impl.role
import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
-import com.kotlindiscord.kord.extensions.types.respond
+import com.kotlindiscord.kord.extensions.utils.tagOrUsername
import dev.kord.common.entity.Permission
import dev.kord.core.entity.Member
import dev.kord.core.entity.Role
-import dev.kord.rest.builder.message.create.allowedMentions
+import dev.kord.rest.builder.message.allowedMentions
import org.koin.core.component.inject
import org.quiltmc.community.database.collections.TeamCollection
import org.quiltmc.community.database.entities.Team
@@ -43,7 +43,7 @@ class SubteamsExtension : Extension() {
if (this.member?.asMemberOrNull()?.mayManageRole(arguments.role) == true) {
arguments.targetUser.addRole(
arguments.role.id,
- "${this.user.asUserOrNull()?.tag ?: this.user.id} used /team add"
+ "${this.user.asUserOrNull()?.tagOrUsername() ?: this.user.id} used /team add"
)
respond {
@@ -70,7 +70,7 @@ class SubteamsExtension : Extension() {
if (this.member?.asMemberOrNull()?.mayManageRole(arguments.role) == true) {
arguments.targetUser.removeRole(
arguments.role.id,
- "${this.user.asUserOrNull()?.tag ?: this.user.id} used /team remove"
+ "${this.user.asUserOrNull()?.tagOrUsername() ?: this.user.id} used /team remove"
)
respond {
content = "Successfully removed ${arguments.targetUser.mention} from " +
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 e7a2c3f4..9a500415 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
@@ -15,7 +15,6 @@ 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.types.respond
import com.kotlindiscord.kord.extensions.utils.hasPermission
import com.kotlindiscord.kord.extensions.utils.timeoutUntil
import com.kotlindiscord.kord.extensions.utils.translate
@@ -28,11 +27,11 @@ import dev.kord.core.event.Event
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.create.embed
+import dev.kord.rest.builder.message.embed
+import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.toList
import kotlinx.datetime.Instant
-import mu.KotlinLogging
import org.quiltmc.community.GUILDS
import org.quiltmc.community.inQuiltGuild
import org.quiltmc.community.notInCollab
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 4deb8c97..e21c4cf5 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
@@ -31,9 +31,6 @@ 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.types.edit
-import com.kotlindiscord.kord.extensions.types.respond
-import com.kotlindiscord.kord.extensions.types.respondEphemeral
import com.kotlindiscord.kord.extensions.utils.*
import dev.kord.common.annotation.KordPreview
import dev.kord.common.entity.*
@@ -50,9 +47,9 @@ import dev.kord.core.event.channel.thread.ThreadUpdateEvent
import dev.kord.core.event.gateway.ReadyEvent
import dev.kord.core.event.guild.MemberUpdateEvent
import dev.kord.core.event.message.MessageCreateEvent
-import dev.kord.rest.builder.message.create.allowedMentions
-import dev.kord.rest.builder.message.create.embed
-import dev.kord.rest.builder.message.modify.embed
+import dev.kord.rest.builder.message.allowedMentions
+import dev.kord.rest.builder.message.embed
+import io.github.oshai.kotlinlogging.KotlinLogging
import io.ktor.client.request.forms.*
import io.ktor.utils.io.jvm.javaio.*
import kotlinx.coroutines.delay
@@ -62,7 +59,6 @@ import kotlinx.datetime.*
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
-import mu.KotlinLogging
import org.koin.core.component.inject
import org.quiltmc.community.*
import org.quiltmc.community.cozy.modules.moderation.compareTo
@@ -210,7 +206,7 @@ class UtilityExtension : Extension() {
action {
val owner = event.channel.owner.asUser()
- logger.info { "Thread created by ${owner.tag}" }
+ logger.info { "Thread created by ${owner.tagOrUsername()}" }
val role = when (event.channel.guildId) {
COMMUNITY_GUILD -> event.channel.guild.getRole(COMMUNITY_MODERATOR_ROLE)
@@ -450,7 +446,7 @@ class UtilityExtension : Extension() {
val roles = member.roles.toList().map { it.id }
if (privilegedRoles.any { it in roles }) {
- targetMessages.forEach { it.pin("Pinned by ${member.tag}") }
+ targetMessages.forEach { it.pin("Pinned by ${member.tagOrUsername()}") }
edit { content = "Messages pinned." }
return@action
@@ -462,7 +458,7 @@ class UtilityExtension : Extension() {
return@action
}
- targetMessages.forEach { it.pin("Pinned by ${member.tag}") }
+ targetMessages.forEach { it.pin("Pinned by ${member.tagOrUsername()}") }
edit { content = "Messages pinned." }
}
@@ -483,7 +479,7 @@ class UtilityExtension : Extension() {
val roles = member.roles.toList().map { it.id }
if (privilegedRoles.any { it in roles }) {
- targetMessages.forEach { it.unpin("Unpinned by ${member.tag}") }
+ targetMessages.forEach { it.unpin("Unpinned by ${member.tagOrUsername()}") }
edit { content = "Messages unpinned." }
return@action
@@ -495,7 +491,7 @@ class UtilityExtension : Extension() {
return@action
}
- targetMessages.forEach { it.unpin("Unpinned by ${member.tag}") }
+ targetMessages.forEach { it.unpin("Unpinned by ${member.tagOrUsername()}") }
edit { content = "Messages unpinned." }
}
@@ -524,7 +520,7 @@ class UtilityExtension : Extension() {
val thread = channel.asChannelOfOrNull()
if (thread == null) {
- respondEphemeral {
+ respondOpposite {
content = "**Error:** This channel isn't a thread!"
}
@@ -535,7 +531,7 @@ class UtilityExtension : Extension() {
val formatter = DateTimeFormatter.ofPattern("dd LL, yyyy - kk:mm:ss")
if (thread.lastMessageId == null) {
- respondEphemeral {
+ respondOpposite {
content = "**Error:** This thread has no messages!"
}
@@ -561,7 +557,7 @@ class UtilityExtension : Extension() {
)
if (msg.content.isNotEmpty() || msg.attachments.isNotEmpty()) {
- val authorName = author?.tag ?: msg.data.author.username
+ val authorName = author?.tagOrUsername() ?: msg.data.author.username
this@UtilityExtension.logger.debug { "\nAuthor name: `$authorName`\n${msg.content}\n" }
@@ -604,7 +600,7 @@ class UtilityExtension : Extension() {
)
if (msg.content.isNotEmpty() || msg.attachments.isNotEmpty()) {
- val authorName = author?.tag ?: msg.data.author.username
+ val authorName = author?.tagOrUsername() ?: msg.data.author.username
if (msg.type == MessageType.ChatInputCommand) {
builder.append("🖥️ ")
@@ -664,7 +660,7 @@ class UtilityExtension : Extension() {
channel.edit {
name = arguments.name
- reason = "Renamed by ${member.tag}"
+ reason = "Renamed by ${member.tagOrUsername()}"
}
edit { content = "Thread renamed." }
@@ -681,7 +677,7 @@ class UtilityExtension : Extension() {
channel.edit {
name = arguments.name
- reason = "Renamed by ${member.tag}"
+ reason = "Renamed by ${member.tagOrUsername()}"
}
edit { content = "Thread renamed." }
@@ -710,7 +706,7 @@ class UtilityExtension : Extension() {
this.archived = true
this.locked = arguments.lock
- reason = "Archived by ${user.asUser().tag}"
+ reason = "Archived by ${user.asUser().tagOrUsername()}"
}
edit {
@@ -755,7 +751,7 @@ class UtilityExtension : Extension() {
channel.edit {
archived = true
- reason = "Archived by ${user.asUser().tag}"
+ reason = "Archived by ${user.asUser().tagOrUsername()}"
}
edit { content = "Thread archived." }
@@ -782,7 +778,7 @@ class UtilityExtension : Extension() {
}
if (privilegedRoles.any { it in roles }) {
- arguments.message.pin("Pinned by ${member.tag}")
+ arguments.message.pin("Pinned by ${member.tagOrUsername()}")
edit { content = "Message pinned." }
return@action
@@ -794,7 +790,7 @@ class UtilityExtension : Extension() {
return@action
}
- arguments.message.pin("Pinned by ${member.tag}")
+ arguments.message.pin("Pinned by ${member.tagOrUsername()}")
edit { content = "Message pinned." }
}
@@ -820,7 +816,7 @@ class UtilityExtension : Extension() {
}
if (privilegedRoles.any { it in roles }) {
- arguments.message.unpin("Unpinned by ${member.tag}")
+ arguments.message.unpin("Unpinned by ${member.tagOrUsername()}")
edit { content = "Message unpinned." }
return@action
@@ -832,7 +828,7 @@ class UtilityExtension : Extension() {
return@action
}
- arguments.message.unpin("Unpinned by ${member.tag}")
+ arguments.message.unpin("Unpinned by ${member.tagOrUsername()}")
edit { content = "Message unpinned." }
}
@@ -854,7 +850,7 @@ class UtilityExtension : Extension() {
if (channel.isArchived) {
channel.edit {
archived = false
- reason = "`/thread prevent-archiving` run by ${member.tag}"
+ reason = "`/thread prevent-archiving` run by ${member.tagOrUsername()}"
}
}
@@ -1091,7 +1087,7 @@ class UtilityExtension : Extension() {
.filter { allowedPerms?.contains(it) == true }
.forEach { allowed += it }
- reason = "Mute role permissions update triggered by ${user.asUser().tag}"
+ reason = "Mute role permissions update triggered by ${user.asUser().tagOrUsername()}"
}
channelsUpdated += 1
@@ -1110,7 +1106,7 @@ class UtilityExtension : Extension() {
role.edit {
permissions = Permissions()
- reason = "Mute role permissions update triggered by ${user.asUser().tag}"
+ reason = "Mute role permissions update triggered by ${user.asUser().tagOrUsername()}"
}
respond { content = "Mute role permissions cleared." }
@@ -1180,7 +1176,7 @@ class UtilityExtension : Extension() {
.minus(Permission.SendMessages)
.minus(Permission.SendMessagesInThreads)
- reason = "Server locked down by ${user.asUser().tag}"
+ reason = "Server locked down by ${user.asUser().tagOrUsername()}"
}
moderatorRole.edit {
@@ -1191,7 +1187,7 @@ class UtilityExtension : Extension() {
.plus(Permission.SendMessages)
.plus(Permission.SendMessagesInThreads)
- reason = "Server locked down by ${user.asUser().tag}"
+ reason = "Server locked down by ${user.asUser().tagOrUsername()}"
}
guild?.asGuildOrNull()?.getModLogChannel()?.createEmbed {
@@ -1237,7 +1233,7 @@ class UtilityExtension : Extension() {
.plus(Permission.SendMessages)
.plus(Permission.SendMessagesInThreads)
- reason = "Server unlocked by ${user.asUser().tag}"
+ reason = "Server unlocked by ${user.asUser().tagOrUsername()}"
}
moderatorRole.edit {
@@ -1248,7 +1244,7 @@ class UtilityExtension : Extension() {
.minus(Permission.SendMessages)
.minus(Permission.SendMessagesInThreads)
- reason = "Server unlocked by ${user.asUser().tag}"
+ reason = "Server unlocked by ${user.asUser().tagOrUsername()}"
}
guild?.asGuildOrNull()?.getModLogChannel()?.createEmbed {
@@ -1313,14 +1309,14 @@ class UtilityExtension : Extension() {
ch.editRolePermission(staffRoleId) {
SPEAKING_PERMISSIONS.forEach { allowed += it }
- reason = "Channel locked by ${user.asUser().tag}"
+ reason = "Channel locked by ${user.asUser().tagOrUsername()}"
}
}
ch.editRolePermission(guild!!.id) {
SPEAKING_PERMISSIONS.forEach { denied += it }
- reason = "Channel locked by ${user.asUser().tag}"
+ reason = "Channel locked by ${user.asUser().tagOrUsername()}"
}
ch.createMessage {
@@ -1378,7 +1374,7 @@ class UtilityExtension : Extension() {
val ch = channelObj as TextChannel
ch.getPermissionOverwritesForRole(guild!!.id)
- ?.delete("Channel unlocked by ${user.asUser().tag}")
+ ?.delete("Channel unlocked by ${user.asUser().tagOrUsername()}")
ch.createMessage {
content = "Channel unlocked by a moderator."
@@ -1512,7 +1508,7 @@ class UtilityExtension : Extension() {
.minus(Permission.SendMessages)
.minus(Permission.SendMessagesInThreads)
- reason = "Server locked down by ${user?.asUser()?.tag}"
+ reason = "Server locked down by ${user?.asUser()?.tagOrUsername()}"
}
moderatorRole.edit {
@@ -1523,7 +1519,7 @@ class UtilityExtension : Extension() {
.plus(Permission.SendMessages)
.plus(Permission.SendMessagesInThreads)
- reason = "Server locked down by ${user?.asUser()?.tag}"
+ reason = "Server locked down by ${user?.asUser()?.tagOrUsername()}"
}
guild?.asGuildOrNull()?.getModLogChannel()?.createEmbed {
@@ -1566,7 +1562,7 @@ class UtilityExtension : Extension() {
.plus(Permission.SendMessages)
.plus(Permission.SendMessagesInThreads)
- reason = "Server unlocked by ${user?.asUser()?.tag}"
+ reason = "Server unlocked by ${user?.asUser()?.tagOrUsername()}"
}
moderatorRole.edit {
@@ -1577,7 +1573,7 @@ class UtilityExtension : Extension() {
.minus(Permission.SendMessages)
.minus(Permission.SendMessagesInThreads)
- reason = "Server unlocked by ${user?.asUser()?.tag}"
+ reason = "Server unlocked by ${user?.asUser()?.tagOrUsername()}"
}
guild?.asGuildOrNull()?.getModLogChannel()?.createEmbed {
@@ -1639,14 +1635,14 @@ class UtilityExtension : Extension() {
ch.editRolePermission(staffRoleId) {
SPEAKING_PERMISSIONS.forEach { allowed += it }
- reason = "Channel locked by ${user?.asUser()?.tag}"
+ reason = "Channel locked by ${user?.asUser()?.tagOrUsername()}"
}
}
ch.editRolePermission(guild!!.id) {
SPEAKING_PERMISSIONS.forEach { denied += it }
- reason = "Channel locked by ${user?.asUser()?.tag}"
+ reason = "Channel locked by ${user?.asUser()?.tagOrUsername()}"
}
ch.createMessage {
@@ -1701,7 +1697,7 @@ class UtilityExtension : Extension() {
val ch = channelObj as TextChannel
ch.getPermissionOverwritesForRole(guild!!.id)
- ?.delete("Channel unlocked by ${user?.asUser()?.tag}")
+ ?.delete("Channel unlocked by ${user?.asUser()?.tagOrUsername()}")
ch.createMessage {
content = "Channel unlocked by a moderator."
diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/VerificationExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/VerificationExtension.kt
index ff7abeaa..91cd7b26 100644
--- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/VerificationExtension.kt
+++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/VerificationExtension.kt
@@ -10,9 +10,9 @@ import com.kotlindiscord.kord.extensions.extensions.Extension
import com.kotlindiscord.kord.extensions.extensions.event
import dev.kord.core.event.guild.GuildCreateEvent
import dev.kord.core.event.guild.MemberUpdateEvent
+import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.filter
-import mu.KotlinLogging
import org.koin.core.component.inject
import org.quiltmc.community.database.collections.ServerSettingsCollection
import org.quiltmc.community.inQuiltGuild
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 b8218daa..ecff85b9 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
@@ -26,13 +26,7 @@ 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.types.editingPaginator
-import com.kotlindiscord.kord.extensions.types.respond
-import com.kotlindiscord.kord.extensions.utils.deleteIgnoringNotFound
-import com.kotlindiscord.kord.extensions.utils.dm
-import com.kotlindiscord.kord.extensions.utils.getJumpUrl
-import com.kotlindiscord.kord.extensions.utils.respond
-import com.kotlindiscord.kord.extensions.utils.timeout
+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
@@ -45,8 +39,8 @@ import dev.kord.core.event.message.MessageCreateEvent
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.create.embed
-import mu.KotlinLogging
+import dev.kord.rest.builder.message.embed
+import io.github.oshai.kotlinlogging.KotlinLogging
import net.codebox.homoglyph.HomoglyphBuilder
import org.koin.core.component.inject
import org.quiltmc.community.*
@@ -204,7 +198,7 @@ class FilterExtension : Extension() {
field {
name = "Moderator"
- value = "${user.mention} (`${user.id.value}` / `${user.asUser().tag}`)"
+ value = "${user.mention} (`${user.id.value}` / `${user.asUser().tagOrUsername()}`)"
}
}
@@ -248,7 +242,7 @@ class FilterExtension : Extension() {
field {
name = "Moderator"
- value = "${user.mention} (`${user.id.value}` / `${user.asUser().tag}`)"
+ value = "${user.mention} (`${user.id.value}` / `${user.asUser().tagOrUsername()}`)"
}
}
@@ -311,7 +305,7 @@ class FilterExtension : Extension() {
field {
name = "Moderator"
- value = "${user.mention} (`${user.id.value}` / `${user.asUser().tag}`)"
+ value = "${user.mention} (`${user.id.value}` / `${user.asUser().tagOrUsername()}`)"
}
}
@@ -364,7 +358,7 @@ class FilterExtension : Extension() {
field {
name = "Moderator"
- value = "${user.mention} (`${user.id.value}` / `${user.asUser().tag}`)"
+ value = "${user.mention} (`${user.id.value}` / `${user.asUser().tagOrUsername()}`)"
}
}
@@ -408,7 +402,7 @@ class FilterExtension : Extension() {
field {
name = "Moderator"
- value = "${user.mention} (`${user.id.value}` / `${user.asUser().tag}`)"
+ value = "${user.mention} (`${user.id.value}` / `${user.asUser().tagOrUsername()}`)"
}
}
@@ -461,7 +455,7 @@ class FilterExtension : Extension() {
field {
name = "Moderator"
- value = "${user.mention} (`${user.id.value}` / `${user.asUser().tag}`)"
+ value = "${user.mention} (`${user.id.value}` / `${user.asUser().tagOrUsername()}`)"
}
}
@@ -525,7 +519,7 @@ class FilterExtension : Extension() {
field {
name = "Moderator"
- value = "${user.mention} (`${user.id.value}` / `${user.asUser().tag}`)"
+ value = "${user.mention} (`${user.id.value}` / `${user.asUser().tagOrUsername()}`)"
}
}
@@ -568,7 +562,7 @@ class FilterExtension : Extension() {
field {
name = "Moderator"
- value = "${user.mention} (`${user.id.value}` / `${user.asUser().tag}`)"
+ value = "${user.mention} (`${user.id.value}` / `${user.asUser().tagOrUsername()}`)"
}
}
@@ -764,7 +758,7 @@ class FilterExtension : Extension() {
field {
inline = true
name = "User"
- value = "${member.mention} (`${member.id}` / `${member.tag}`)"
+ value = "${member.mention} (`${member.id}` / `${member.tagOrUsername()}`)"
}
field {
@@ -980,7 +974,7 @@ class FilterExtension : Extension() {
field {
inline = true
name = "Author"
- value = "${message.author!!.mention} (`${message.author!!.id.value}` / `${message.author!!.tag}`)"
+ value = "${message.author!!.mention} (`${message.author!!.id.value}` / `${message.author!!.tagOrUsername()}`)"
}
field {
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 aba7c5e9..7e039a93 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
@@ -20,10 +20,9 @@ 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.types.editingPaginator
-import com.kotlindiscord.kord.extensions.types.respond
import dev.kord.common.entity.Permission
import dev.kord.core.behavior.channel.createEmbed
+import io.github.oshai.kotlinlogging.KotlinLogging
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.engine.cio.*
@@ -33,7 +32,6 @@ import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.serialization.kotlinx.json.*
import kotlinx.serialization.json.Json
-import mu.KotlinLogging
import org.quiltmc.community.*
import org.quiltmc.community.modes.quilt.extensions.github.types.GitHubSimpleUser
import quilt.ghgen.DeleteIssue
diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/messagelog/CategoryRotator.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/messagelog/CategoryRotator.kt
index a4076c66..9a6568bd 100644
--- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/messagelog/CategoryRotator.kt
+++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/messagelog/CategoryRotator.kt
@@ -15,13 +15,13 @@ import dev.kord.core.entity.channel.GuildMessageChannel
import dev.kord.core.entity.channel.TextChannel
import dev.kord.core.entity.channel.TopGuildMessageChannel
import dev.kord.rest.builder.message.create.UserMessageCreateBuilder
+import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
-import mu.KotlinLogging
import org.quiltmc.community.COLOUR_NEGATIVE
import org.quiltmc.community.COLOUR_POSITIVE
import java.time.OffsetDateTime
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 8ec308f5..a05315e1 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
@@ -13,6 +13,7 @@ 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 com.kotlindiscord.kord.extensions.utils.tagOrUsername
import dev.kord.common.entity.Snowflake
import dev.kord.common.entity.optional.Optional
import dev.kord.core.entity.Guild
@@ -27,8 +28,9 @@ import dev.kord.core.event.message.MessageBulkDeleteEvent
import dev.kord.core.event.message.MessageDeleteEvent
import dev.kord.core.event.message.MessageUpdateEvent
import dev.kord.rest.builder.message.EmbedBuilder
-import dev.kord.rest.builder.message.create.allowedMentions
-import dev.kord.rest.builder.message.create.embed
+import dev.kord.rest.builder.message.allowedMentions
+import dev.kord.rest.builder.message.embed
+import io.github.oshai.kotlinlogging.KotlinLogging
import io.ktor.client.request.forms.*
import io.ktor.utils.io.jvm.javaio.*
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -42,7 +44,6 @@ import kotlinx.datetime.Clock
import kotlinx.datetime.Instant
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
-import mu.KotlinLogging
import org.quiltmc.community.*
import java.time.ZoneId
import java.time.format.DateTimeFormatter
@@ -107,7 +108,7 @@ class MessageLogExtension : Extension() {
messages += "**ID:** ${it.id.value}\n\n"
if (it.author != null) {
- messages += "**Author:** ${it.author!!.tag}\n"
+ messages += "**Author:** ${it.author!!.tagOrUsername()}\n"
messages += "**Author ID:** ${it.author!!.id.value}\n\n"
} else {
messages += "**Display Name:** ${it.data.author.username}\n"
@@ -551,7 +552,7 @@ class MessageLogExtension : Extension() {
field {
name = "Author ID/Tag"
- value = "`${author.id.value}` / `${author.tag}`"
+ value = "`${author.id.value}` / `${author.tagOrUsername()}`"
inline = true
}
} else {
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 cc8414b0..e56dd435 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
@@ -15,8 +15,6 @@ 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.types.editingPaginator
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.scheduling.Scheduler
import com.kotlindiscord.kord.extensions.utils.scheduling.Task
import dev.kord.common.annotation.KordPreview
@@ -27,14 +25,14 @@ import dev.kord.core.entity.channel.NewsChannel
import dev.kord.core.entity.channel.TextChannel
import dev.kord.core.entity.channel.TopGuildMessageChannel
import dev.kord.rest.builder.message.EmbedBuilder
-import dev.kord.rest.builder.message.create.embed
+import dev.kord.rest.builder.message.embed
+import io.github.oshai.kotlinlogging.KotlinLogging
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.plugins.contentnegotiation.*
import io.ktor.client.request.*
import io.ktor.serialization.kotlinx.json.*
import kotlinx.datetime.Clock
-import mu.KotlinLogging
import org.apache.commons.text.StringEscapeUtils
import org.quiltmc.community.*
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 9c694acf..b7439adb 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
@@ -25,7 +25,8 @@ import dev.kord.core.entity.Message
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.create.embed
+import dev.kord.rest.builder.message.embed
+import io.github.oshai.kotlinlogging.KotlinLogging
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.plugins.*
@@ -38,7 +39,6 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.serialization.json.Json
-import mu.KotlinLogging
import org.koin.core.component.inject
import org.quiltmc.community.*
import org.quiltmc.community.database.collections.OwnedThreadCollection
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 6f773fa3..138f506b 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
@@ -19,21 +19,17 @@ 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 com.kotlindiscord.kord.extensions.types.respond
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.create.embed
+import dev.kord.rest.builder.message.embed
+import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
-import mu.KotlinLogging
import org.koin.core.component.inject
import org.quiltmc.community.*
-import org.quiltmc.community.COLLAB_GUILD
-import org.quiltmc.community.GUILDS
-import org.quiltmc.community.MAIN_GUILD
import org.quiltmc.community.database.collections.GlobalSettingsCollection
import org.quiltmc.community.database.collections.ServerSettingsCollection
import org.quiltmc.community.database.collections.UserFlagsCollection
diff --git a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/suggestions/SuggestionsExtension.kt b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/suggestions/SuggestionsExtension.kt
index 7cc7bb39..489a48c2 100644
--- a/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/suggestions/SuggestionsExtension.kt
+++ b/src/main/kotlin/org/quiltmc/community/modes/quilt/extensions/suggestions/SuggestionsExtension.kt
@@ -21,7 +21,6 @@ import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand
import com.kotlindiscord.kord.extensions.extensions.event
import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.events.ProxiedMessageCreateEvent
import com.kotlindiscord.kord.extensions.modules.extra.pluralkit.events.UnProxiedMessageCreateEvent
-import com.kotlindiscord.kord.extensions.types.respond
import com.kotlindiscord.kord.extensions.utils.*
import dev.kord.common.annotation.KordPreview
import dev.kord.common.entity.ButtonStyle
@@ -41,12 +40,10 @@ import dev.kord.core.entity.interaction.ButtonInteraction
import dev.kord.core.event.channel.thread.ThreadChannelCreateEvent
import dev.kord.core.event.interaction.InteractionCreateEvent
import dev.kord.core.event.message.MessageCreateEvent
+import dev.kord.rest.builder.message.actionRow
import dev.kord.rest.builder.message.create.MessageCreateBuilder
-import dev.kord.rest.builder.message.create.actionRow
-import dev.kord.rest.builder.message.create.embed
+import dev.kord.rest.builder.message.embed
import dev.kord.rest.builder.message.modify.MessageModifyBuilder
-import dev.kord.rest.builder.message.modify.actionRow
-import dev.kord.rest.builder.message.modify.embed
import io.github.evanrupert.excelkt.Sheet
import io.github.evanrupert.excelkt.workbook
import io.ktor.client.request.forms.*
@@ -125,7 +122,8 @@ class SuggestionsExtension : Extension() {
owner = event.message.author!!.id,
ownerAvatar = event.message.author!!.avatar?.cdnUrl?.toUrl(),
- ownerName = event.message.author!!.asMember(event.message.getGuild().id).displayName,
+ ownerName = event.message.author!!.asMember(event.message.getGuild().id)
+ .let { it.globalName ?: it.username },
positiveVoters = mutableListOf(event.message.author!!.id)
)
@@ -162,7 +160,7 @@ class SuggestionsExtension : Extension() {
owner = event.pkMessage.sender,
ownerAvatar = event.pkMessage.member?.avatarUrl,
- ownerName = event.pkMessage.member?.name ?: event.author.displayName,
+ ownerName = event.pkMessage.member?.name ?: event.author.globalName ?: event.author.username,
positiveVoters = mutableListOf(event.pkMessage.sender),