Skip to content

Commit

Permalink
Migrate to Kord Extensions 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
russellbanks committed Dec 11, 2023
1 parent 612e03f commit 6a28879
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -37,7 +38,7 @@ suspend fun main() {
Dao.setupCache()
ExtensibleBot(EnvironmentVariables.discordApiKey) {
intents {
+Intents.nonPrivileged
+Intents.NON_PRIVILEGED
+Intent.Guilds
+Intent.GuildVoiceStates
+Intent.GuildMembers
Expand Down
10 changes: 4 additions & 6 deletions src/main/kotlin/extensions/ConfigureExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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()
Expand All @@ -83,7 +81,7 @@ class ConfigureExtension: Extension() {
}
)
}
}
})
components {
if (member != null) {
for (action in Action.entries) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 6a28879

Please sign in to comment.