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

Forms support #531

merged 33 commits into from
Feb 20, 2022

Conversation

HopeBaron
Copy link
Member

  • Adds Form support
  • changes the tree of Interactions to match the following diagram:

common/src/main/kotlin/entity/DiscordComponent.kt Outdated Show resolved Hide resolved
core/src/main/kotlin/behavior/GuildInteractionBehavior.kt Outdated Show resolved Hide resolved
core/src/main/kotlin/behavior/GlobalInteractionBehavior.kt Outdated Show resolved Hide resolved
core/src/main/kotlin/behavior/GuildInteractionBehavior.kt Outdated Show resolved Hide resolved
rest/src/main/kotlin/builder/interaction/ModalBuilder.kt Outdated Show resolved Hide resolved
rest/src/main/kotlin/service/InteractionService.kt Outdated Show resolved Hide resolved
rest/src/main/kotlin/service/InteractionService.kt Outdated Show resolved Hide resolved
rest/src/main/kotlin/service/InteractionService.kt Outdated Show resolved Hide resolved
@lukellmann
Copy link
Member

lukellmann commented Feb 12, 2022

ActionRowComponent should probably get a new textInputs property

Edit: it was added in 4b96ef5

HopeBaron and others added 3 commits February 18, 2022 10:52
* move MessageInteraction into Message

* interactions

* clarify why ComponentInteractionBehavior is no ModalParentInteractionBehavior

* typo

* rename ApplicationCommandInteractionInteractionCreateEvent to ApplicationCommandInteractionCreateEvent

* move ResolvedObjects

* attachments in InteractionCommand

* fix InteractionCommand.filterOptions()

* Entity in mentionables again

* move duplicate code to InteractionCommand

* ActionRowComponent docs

* rename acknowledge

* maps for components
@@ -695,6 +699,7 @@ public sealed class InteractionResponseType(public val type: Int) {
public object DeferredUpdateMessage : InteractionResponseType(6)
public object UpdateMessage : InteractionResponseType(7)
public object ApplicationCommandAutoCompleteResult : InteractionResponseType(8)
public object Modal : InteractionResponseType(9)
Copy link
Member

@lukellmann lukellmann Feb 20, 2022

Choose a reason for hiding this comment

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

missing 9 -> Modal in deserialize of InteractionResponseType.Serializer (but usually it should only be serialized)


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

override suspend fun getChannelOrNull(): MessageChannel? = supplier.getChannelOfOrNull(channelId)
Copy link
Member

Choose a reason for hiding this comment

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

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

Comment on lines 4 to 7
* The behavior of an ephemeral [Discord ActionInteraction Response](https://discord.com/developers/docs/interactions/slash-commands#interaction-response)
* This response is visible to *only* to the user who made the interaction.
*/
public sealed interface EphemeralInteractionResponseBehavior : InteractionResponseBehavior
Copy link
Member

Choose a reason for hiding this comment

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

this link leads nowhere

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

public sealed interface PublicInteractionResponseBehavior : InteractionResponseBehavior
Copy link
Member

Choose a reason for hiding this comment

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

this link leads nowhere

Comment on lines 673 to 680
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

@HopeBaron HopeBaron merged commit b4d77e0 into 0.8.x Feb 20, 2022
@HopeBaron HopeBaron deleted the feature/forms branch March 8, 2022 08:09
@mrsrmn mrsrmn mentioned this pull request Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants