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

delete/edit acknowledgements #246

Merged
merged 2 commits into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions core/src/main/kotlin/behavior/GuildInteractionBehavior.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ interface GuildInteractionBehavior : InteractionBehavior {

suspend fun getGuild(): Guild = supplier.getGuild(guildId)

companion object {

}
companion object;

}
25 changes: 4 additions & 21 deletions core/src/main/kotlin/behavior/InteractionResponseBehavior.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,14 @@ interface InteractionResponseBehavior : KordObject {
val applicationId: Snowflake
val token: String

}

@KordPreview
fun InteractionResponseBehavior(applicationId: Snowflake, token: String, kord: Kord) =
object : InteractionResponseBehavior {
override val applicationId: Snowflake
get() = applicationId

override val token: String
get() = token

override val kord: Kord
get() = kord
}

@KordPreview
interface EditableInteractionResponseBehavior : InteractionResponseBehavior {

suspend fun delete() {
kord.rest.interaction.deleteOriginalInteractionResponse(applicationId, token)
}
}

@KordPreview
fun EditableInteractionResponseBehavior(applicationId: Snowflake, token: String, kord: Kord) =
object : EditableInteractionResponseBehavior {
fun InteractionResponseBehavior(applicationId: Snowflake, token: String, kord: Kord) =
object : InteractionResponseBehavior {
override val applicationId: Snowflake
get() = applicationId

Expand All @@ -56,7 +39,7 @@ fun EditableInteractionResponseBehavior(applicationId: Snowflake, token: String,

@KordPreview
@OptIn(ExperimentalContracts::class)
suspend inline fun EditableInteractionResponseBehavior.edit(builder: InteractionResponseModifyBuilder.() -> Unit): Message {
suspend inline fun InteractionResponseBehavior.edit(builder: InteractionResponseModifyBuilder.() -> Unit): Message {
contract { callsInPlace(builder, InvocationKind.EXACTLY_ONCE) }
val request = InteractionResponseModifyBuilder().apply(builder).toRequest()
val response = kord.rest.interaction.modifyInteractionResponse(applicationId, token, request)
Expand Down