From 113f00f69f135c544b438a52c8260fd66dffffb2 Mon Sep 17 00:00:00 2001 From: Michael Rittmeister Date: Tue, 9 Apr 2024 20:49:58 +0200 Subject: [PATCH] Fix unsafe api usage --- samples/src/commonMain/kotlin/dev/kord/core/PingBot.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/samples/src/commonMain/kotlin/dev/kord/core/PingBot.kt b/samples/src/commonMain/kotlin/dev/kord/core/PingBot.kt index c132ddf398f..1fa305bd312 100644 --- a/samples/src/commonMain/kotlin/dev/kord/core/PingBot.kt +++ b/samples/src/commonMain/kotlin/dev/kord/core/PingBot.kt @@ -1,10 +1,10 @@ package dev.kord.core -import dev.kord.core.behavior.reply +import dev.kord.core.behavior.channel.PollParentChannelBehavior +import dev.kord.core.behavior.channel.createPoll import dev.kord.core.event.message.MessageCreateEvent import dev.kord.gateway.Intent import dev.kord.gateway.PrivilegedIntent -import dev.kord.rest.builder.message.create.poll import kotlin.time.Duration.Companion.minutes suspend fun main(args: Array) { @@ -14,8 +14,7 @@ suspend fun main(args: Array) { if (message.author?.isBot == true) return@on if (message.content == "!ping") message.channel.createMessage("pong") if (message.content == "!poll") { - message.reply { - poll { + (message.channel as PollParentChannelBehavior).createPoll { question("Does this work?") answer("Yes") @@ -25,7 +24,6 @@ suspend fun main(args: Array) { } } } - } kord.login { presence { playing("!ping to pong") }