-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Message interaction #283
Message interaction #283
Changes from 2 commits
46ce222
9845a9e
ffc820e
e0beb76
2eb43db
9c05902
52aec9c
109a947
3eee684
960c6f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,36 @@ import dev.kord.common.annotation.KordPreview | |
import dev.kord.common.entity.InteractionType | ||
import dev.kord.common.entity.Snowflake | ||
import dev.kord.core.Kord | ||
import dev.kord.core.behavior.UserBehavior | ||
import dev.kord.core.entity.KordEntity | ||
import dev.kord.core.entity.User | ||
import dev.kord.core.entity.Message | ||
|
||
/** | ||
* An instance of [MessageInteraction](https://discord.com/developers/docs/interactions/slash-commands#messageinteraction) | ||
* This is sent on the [Message] object when the message is a response to an [Interaction]. | ||
*/ | ||
@KordPreview | ||
class MessageInteraction(val data: MessageInteractionData, override val kord: Kord): KordEntity { | ||
class MessageInteraction( | ||
val data: MessageInteractionData, | ||
override val kord: Kord, | ||
) : KordEntity { | ||
/** | ||
* [id][Interaction.id] of the [Interaction] this message is responding to. | ||
*/ | ||
override val id: Snowflake get() = data.id | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the interactions's ID, right? Is there any kind of behavior/entity we can get from this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there isn't but since it had an ID and requires Kord for the user object that it would be fine to consider it a KordEntity |
||
|
||
/** | ||
* the [name][ApplicationCommand.name] of the [ApplicationCommand] that triggered this message. | ||
*/ | ||
val name: String get() = data.name | ||
val user: User get() = User(data.user, kord) | ||
|
||
/** | ||
* The [UserBehavior] of the [user][Interaction.user] who invoked the [Interaction] | ||
*/ | ||
val user: UserBehavior get() = UserBehavior(data.id, kord) | ||
Comment on lines
+37
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs the usual |
||
|
||
/** | ||
* the [InteractionType] of the interaction [MessageInteraction]. | ||
*/ | ||
val type: InteractionType get() = data.type | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider documenting this