elbekD / kt-telegram-bot

Telegram Bot Library for Kotlin language
MIT License
104 stars 19 forks source link

CallbackQuery bug #21

Closed vitaB closed 4 years ago

vitaB commented 4 years ago

I think there is a bug in the Bot.onCallbackQuery(). The function should get an CallbackQuery instead of InlineQuery as parameter.

vitaB commented 4 years ago
index 9891cb3..3aa0f8b 100644
--- a/library/src/main/kotlin/com/elbekD/bot/Bot.kt
+++ b/library/src/main/kotlin/com/elbekD/bot/Bot.kt
@@ -121,12 +121,12 @@ interface Bot : TelegramApi {
     fun removeChosenInlineQueryAction()

     /**
-     * @param action called on [InlineQuery] update
+     * @param action called on [CallbackQuery] update
      */
-    fun onCallbackQuery(action: suspend (InlineQuery) -> Unit)
+    fun onCallbackQuery(action: suspend (CallbackQuery) -> Unit)

     /**
-     * Removes [InlineQuery] update action
+     * Removes [CallbackQuery] update action
      */
     fun removeCallbackQueryAction()

diff --git a/library/src/main/kotlin/com/elbekD/bot/TelegramBot.kt b/library/src/main/kotlin/com/elbekD/bot/TelegramBot.kt
index be91341..340148d 100644
--- a/library/src/main/kotlin/com/elbekD/bot/TelegramBot.kt
+++ b/library/src/main/kotlin/com/elbekD/bot/TelegramBot.kt
@@ -103,7 +103,7 @@ internal abstract class TelegramBot protected constructor(username: String, tk:
         updateHandler.on<ChosenInlineResult>(AllowedUpdate.ChosenInlineQuery, null)
     }

-    override fun onCallbackQuery(action: suspend (InlineQuery) -> Unit) {
+    override fun onCallbackQuery(action: suspend (CallbackQuery) -> Unit) {
         updateHandler.on(AllowedUpdate.CallbackQuery, action)
     }
elbekD commented 4 years ago

thnx @vitaB. released 1.2.5 version with fix