Skip to content
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

Forms support #531

Merged
merged 33 commits into from
Feb 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4016de0
Initial modals implementation
MrPowerGamerBR Feb 9, 2022
08a7cac
Change the "DiscordComponent" model to multiple classes due to button…
MrPowerGamerBR Feb 9, 2022
2b1f43a
Canonical order
MrPowerGamerBR Feb 9, 2022
89e1e30
Use two ***DiscordComponents classes for everything
MrPowerGamerBR Feb 9, 2022
7c39464
Rename the classes because it looks better this way
MrPowerGamerBR Feb 9, 2022
3856eee
Revert core changes
MrPowerGamerBR Feb 9, 2022
8d03e60
Implement text input component classes in the core module
MrPowerGamerBR Feb 9, 2022
8223e43
Fix TextInput component type deserialization
MrPowerGamerBR Feb 9, 2022
50a837e
improve the interaction tree
HopeBaron Feb 10, 2022
ec873d5
More changes to the tree
HopeBaron Feb 10, 2022
9eccb31
remove unresolved references
HopeBaron Feb 10, 2022
769c8d6
add core events
HopeBaron Feb 10, 2022
660f477
Apply suggestions from code review
HopeBaron Feb 11, 2022
eadce4d
change compontents top level to ActionRowBuilder
HopeBaron Feb 12, 2022
fa8a415
refactor files
HopeBaron Feb 12, 2022
a5a8272
refactor interaction files
HopeBaron Feb 12, 2022
f810972
refactor response files
HopeBaron Feb 12, 2022
992fac9
refactor followup messages
HopeBaron Feb 12, 2022
4b96ef5
add TextInputComponent list retrival property
HopeBaron Feb 12, 2022
edd6ff0
fix withStrategy return type
HopeBaron Feb 12, 2022
5e60f60
Apply suggestions from code review
HopeBaron Feb 12, 2022
81eab28
rename discord modal component to DiscordTextInputComponent
HopeBaron Feb 12, 2022
afab86b
fix interaction response type
HopeBaron Feb 12, 2022
8f705e7
Forms support adjustments (#534)
lukellmann Feb 12, 2022
8ae546f
GuildAutoCompleteInteraction is GuildInteraction (#535)
lukellmann Feb 12, 2022
5d9be2c
required is true by default for text inputs (#537)
lukellmann Feb 15, 2022
39d7608
Merge branch '0.8.x' into feature/forms
HopeBaron Feb 17, 2022
71159e9
rewrite a safer OptionValue implementation
HopeBaron Feb 17, 2022
a63e10f
Apply code review suggestions
HopeBaron Feb 18, 2022
0fb59bc
Yeet out IntOptionValue
HopeBaron Feb 18, 2022
9838aef
Fix interactions for forms feature (#538)
lukellmann Feb 19, 2022
a5bb146
cleanup and consider feedback in codereview
HopeBaron Feb 20, 2022
5f13f84
reintroduce CommandArgument convience methods
HopeBaron Feb 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions common/src/main/kotlin/entity/Interactions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -670,26 +670,6 @@ public data class CommandGroup(
get() = ApplicationCommandOptionType.SubCommandGroup
}

public fun CommandArgument<*>.int(): Long {
return value as? Long ?: error("$value wasn't an int.")
}


public fun CommandArgument<*>.string(): String {
return value.toString()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these two are used in tests



public fun CommandArgument<*>.boolean(): Boolean {
return value as? Boolean ?: error("$value wasn't a Boolean.")
}


public fun CommandArgument<*>.snowflake(): Snowflake {
val id = string().toULongOrNull() ?: error("$value wasn't a Snowflake")
return Snowflake(id)
}

@Serializable(InteractionResponseType.Serializer::class)

public sealed class InteractionResponseType(public val type: Int) {
Expand All @@ -715,6 +695,7 @@ public sealed class InteractionResponseType(public val type: Int) {
6 -> DeferredUpdateMessage
7 -> UpdateMessage
8 -> ApplicationCommandAutoCompleteResult
9 -> Modal
else -> Unknown(type)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public interface GuildInteractionBehavior : InteractionBehavior {

override suspend fun getChannel(): GuildMessageChannel = supplier.getChannelOf(channelId)

override suspend fun getChannelOrNull(): MessageChannel? = supplier.getChannelOfOrNull(channelId)
override suspend fun getChannelOrNull(): GuildMessageChannel? = supplier.getChannelOfOrNull(channelId)

override fun withStrategy(strategy: EntitySupplyStrategy<*>): GuildInteractionBehavior =
GuildInteractionBehavior(guildId, id, channelId, applicationId, token, kord, supplier)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.kord.core.behavior.interaction.response

/**
* The behavior of an ephemeral [Discord ActionInteraction Response](https://discord.com/developers/docs/interactions/slash-commands#interaction-response)
* The behavior of an ephemeral Discord Interaction Response
* This response is visible to *only* to the user who made the interaction.
*/
public sealed interface EphemeralInteractionResponseBehavior : InteractionResponseBehavior
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import dev.kord.rest.request.RestRequestException


/**
* The behavior of a public [Discord ActionInteraction Response](https://discord.com/developers/docs/interactions/slash-commands#interaction-response)
* The behavior of a public Discord Interaction Response
* This response is visible to all users in the channel.
*/

Expand Down