Skip to content

Commit

Permalink
Fix merge related syntax errors
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Jun 7, 2021
1 parent 9016ae3 commit c2bf627
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/src/main/kotlin/entity/Message.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.kord.core.entity

import dev.kord.common.annotation.KordPreview
import dev.kord.common.entity.DiscordComponent
import dev.kord.common.entity.MessageType
import dev.kord.common.entity.Snowflake
Expand Down
42 changes: 42 additions & 0 deletions core/src/samples/kotlin/PingBot.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,57 @@
import dev.kord.common.annotation.KordPreview
import dev.kord.common.entity.ButtonStyle
import dev.kord.core.Kord
import dev.kord.core.behavior.channel.createMessage
import dev.kord.core.behavior.interaction.respondPublic
import dev.kord.core.builder.components.emoji
import dev.kord.core.cache.data.ApplicationComponentInteractionData
import dev.kord.core.entity.ReactionEmoji
import dev.kord.core.entity.interaction.ComponentInteraction
import dev.kord.core.event.interaction.InteractionCreateEvent
import dev.kord.core.event.message.MessageCreateEvent
import dev.kord.core.on

@KordPreview
suspend fun main(args: Array<String>) {
val kord = Kord(args.firstOrNull() ?: error("token required"))

kord.on<MessageCreateEvent> {
if (message.author?.isBot == true) return@on
if (message.content == "!ping") message.channel.createMessage("pong")
if (message.content == "!buttons") {
message.channel.createMessage {
content = "Ich mag ~~Züge~~ Buttons"

components {
actionRow {
interactionButton(ButtonStyle.Primary, "eliteblog") {
emoji(ReactionEmoji.Unicode("\uD83D\uDE38"))
disabled = true
}
// interactionButton(
// "eliteblog2"
// ) {
// emoji(ReactionEmoji.Unicode("\uD83D\uDE38"))
// }
}
// actionRow {
// linkButton("DuckDuckGo but gud", "https://google.com")
// }
}
}

}
}

kord.on<InteractionCreateEvent> {
val interaction1 = interaction
if (interaction1 is ComponentInteraction) {
if ((interaction1.data.data as ApplicationComponentInteractionData).customId.value == "eliteblog2") {
interaction.respondPublic {
content = "Discord sucks!"
}
}
}
}

kord.login { playing("!ping to pong") }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class EphemeralFollowupMessageCreateBuilder(var content: String) :
FollowupMessageCreateRequest(
content = Optional.Value(content),
tts = _tts,
allowedMentions = _allowedMentions.map { it.build() }
allowedMentions = _allowedMentions.map { it.build() },
components = Optional.missingOnEmpty(components.map(MessageComponentBuilder::build))
),
)
Expand Down
2 changes: 1 addition & 1 deletion rest/src/main/kotlin/builder/message/EmbedBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class EmbedBuilder : RequestBuilder<EmbedRequest> {
Optional.Value("embed"),
_description,
_url,
_timestamp,
_timestamp.map { it.toString() },
_color,
_footer.map { it.toRequest() },
_image.map { EmbedImageRequest(it) },
Expand Down

0 comments on commit c2bf627

Please sign in to comment.