From 6a28879b65874ce9495566c4f8d71e392b40a857 Mon Sep 17 00:00:00 2001 From: Russell Banks <74878137+russellbanks@users.noreply.github.com> Date: Mon, 11 Dec 2023 09:28:28 +0000 Subject: [PATCH] Migrate to Kord Extensions 1.6.0 --- src/main/kotlin/Main.kt | 3 ++- src/main/kotlin/extensions/ConfigureExtension.kt | 10 ++++------ .../extensions/voicestateupdate/VoiceStateExtension.kt | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) 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 {