From 631b5bafb68ba3e5a39bf932431d2b940245a94c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 09:47:06 +0000 Subject: [PATCH] Update kord.extensions to v1.6.0 (#110) * Update kord.extensions to v1.6.0 * Migrate to Kord Extensions 1.6.0 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Russell Banks <74878137+russellbanks@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- src/main/kotlin/Main.kt | 3 ++- src/main/kotlin/extensions/ConfigureExtension.kt | 10 ++++------ .../extensions/voicestateupdate/VoiceStateExtension.kt | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3bfa74e..e907465 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -kord-extensions = "1.5.7-20230506.104616-11" +kord-extensions = "1.6.0" kordx-emoji = "0.5.0" kotlin = "1.9.21" kotlinx-coroutines = "1.7.3" diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index c9198fd..3465ffe 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -23,6 +23,7 @@ import com.kotlindiscord.kord.extensions.checks.isNotBot import data.Dao import dev.kord.gateway.Intent import dev.kord.gateway.Intents +import dev.kord.gateway.NON_PRIVILEGED import dev.kord.gateway.PrivilegedIntent import extensions.ConfigureExtension import extensions.joinleaveupdate.CreateChannelExtension @@ -37,7 +38,7 @@ suspend fun main() { Dao.setupCache() ExtensibleBot(EnvironmentVariables.discordApiKey) { intents { - +Intents.nonPrivileged + +Intents.NON_PRIVILEGED +Intent.Guilds +Intent.GuildVoiceStates +Intent.GuildMembers diff --git a/src/main/kotlin/extensions/ConfigureExtension.kt b/src/main/kotlin/extensions/ConfigureExtension.kt index e5442b7..b62b657 100644 --- a/src/main/kotlin/extensions/ConfigureExtension.kt +++ b/src/main/kotlin/extensions/ConfigureExtension.kt @@ -32,16 +32,14 @@ import com.kotlindiscord.kord.extensions.components.publicButton import com.kotlindiscord.kord.extensions.components.types.emoji import com.kotlindiscord.kord.extensions.extensions.Extension import com.kotlindiscord.kord.extensions.extensions.ephemeralSlashCommand -import com.kotlindiscord.kord.extensions.types.edit -import com.kotlindiscord.kord.extensions.types.respond import data.Dao import dev.kord.common.Color import dev.kord.common.entity.ButtonStyle import dev.kord.common.entity.ChannelType import dev.kord.common.entity.Permission import dev.kord.core.behavior.GuildBehavior -import dev.kord.rest.builder.message.create.embed -import dev.kord.rest.builder.message.modify.embed +import dev.kord.rest.builder.message.EmbedBuilder +import dev.kord.rest.builder.message.embed import dev.kord.x.emoji.Emojis import extensions.voicestateupdate.Action @@ -64,7 +62,7 @@ class ConfigureExtension: Extension() { action { guild?.let { guild -> respond { - embed { + embed(fun EmbedBuilder.() { author { name = "${guild.asGuild().name} configuration" icon = guild.asGuild().icon?.cdnUrl?.toUrl() @@ -83,7 +81,7 @@ class ConfigureExtension: Extension() { } ) } - } +}) components { if (member != null) { for (action in Action.entries) { diff --git a/src/main/kotlin/extensions/voicestateupdate/VoiceStateExtension.kt b/src/main/kotlin/extensions/voicestateupdate/VoiceStateExtension.kt index 85e8530..4b2c6b0 100644 --- a/src/main/kotlin/extensions/voicestateupdate/VoiceStateExtension.kt +++ b/src/main/kotlin/extensions/voicestateupdate/VoiceStateExtension.kt @@ -53,10 +53,10 @@ class VoiceStateExtension: Extension() { guildPrefs.channelId?.let(::Snowflake)?.let { snowflake -> MessageChannelBehavior(snowflake, kord).createEmbed { color = Color(EnvironmentVariables.accentColor()[0], EnvironmentVariables.accentColor()[1], EnvironmentVariables.accentColor()[2]) - title = "${member.displayName} ${action?.phrase} ${channel?.asChannel()?.name}" + title = "${member.username} ${action?.phrase} ${channel?.asChannel()?.name}" timestamp = Clock.System.now() author { - name = member.displayName + name = member.username icon = member.avatar?.cdnUrl?.toUrl() } footer {