Skip to content

Commit

Permalink
Fix ComponentInteraction User for DMs (#344)
Browse files Browse the repository at this point in the history
Gets the user data from the user field instead of the member field, upgrade the type to a full user.
  • Loading branch information
BartArys authored Jul 10, 2021
1 parent 972e0a0 commit 944d795
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package dev.kord.core.entity.interaction
import dev.kord.common.annotation.KordPreview
import dev.kord.common.entity.ComponentType
import dev.kord.common.entity.Snowflake
import dev.kord.common.entity.optional.map
import dev.kord.common.entity.optional.orEmpty
import dev.kord.common.entity.optional.unwrap
import dev.kord.core.Kord
import dev.kord.core.behavior.UserBehavior
import dev.kord.core.behavior.interaction.ComponentInteractionBehavior
import dev.kord.core.cache.data.InteractionData
import dev.kord.core.entity.Message
import dev.kord.core.entity.User
import dev.kord.core.entity.component.ActionRowComponent
import dev.kord.core.entity.component.ButtonComponent
import dev.kord.core.entity.component.Component
Expand All @@ -27,8 +29,8 @@ import dev.kord.rest.builder.component.SelectMenuBuilder
@KordPreview
sealed class ComponentInteraction : Interaction(), ComponentInteractionBehavior {

override val user: UserBehavior
get() = UserBehavior(data.member.value!!.userId, kord)
override val user: User
get() = User(data.user.value!!, kord)

/**
* The message that contains the interacted component, null if the message is ephemeral.
Expand Down

0 comments on commit 944d795

Please sign in to comment.