From f7803893516d19d97d38e7c80a742dbfc3a6b08c Mon Sep 17 00:00:00 2001 From: bondiano Date: Mon, 30 Sep 2024 18:49:55 +0500 Subject: [PATCH] fix: correct set secret header --- examples/04-keyboard-bot/src/bot.gleam | 1 - examples/04-keyboard-bot/src/language_keyboard.gleam | 2 +- src/telega/adapters/wisp.gleam | 2 +- src/telega/keyboard.gleam | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/04-keyboard-bot/src/bot.gleam b/examples/04-keyboard-bot/src/bot.gleam index 35220c0..027a532 100644 --- a/examples/04-keyboard-bot/src/bot.gleam +++ b/examples/04-keyboard-bot/src/bot.gleam @@ -101,7 +101,6 @@ fn handle_inline_change_language( let assert Ok(language_callback) = telega_keyboard.unpack_callback(payload, callback_data) - let language = language_callback.data use _ <- result.try(reply.answer_callback_query( diff --git a/examples/04-keyboard-bot/src/language_keyboard.gleam b/examples/04-keyboard-bot/src/language_keyboard.gleam index e70f538..0f5afe2 100644 --- a/examples/04-keyboard-bot/src/language_keyboard.gleam +++ b/examples/04-keyboard-bot/src/language_keyboard.gleam @@ -34,7 +34,7 @@ pub fn new_keyboard(lang: Language) { |> keyboard.one_time } -pub fn option_to_language(option: String) -> Language { +pub fn option_to_language(option: String) { case option { "πŸ‡·πŸ‡Ί Russian" -> Russian "πŸ‡¬πŸ‡§ Английский" -> English diff --git a/src/telega/adapters/wisp.gleam b/src/telega/adapters/wisp.gleam index 8969bd7..9a7a7bb 100644 --- a/src/telega/adapters/wisp.gleam +++ b/src/telega/adapters/wisp.gleam @@ -10,7 +10,7 @@ import wisp.{ Empty as WispEmptyBody, } -const secret_header = "X-Telegram-Bot-Api-Secret-Token" +const secret_header = "x-telegram-bot-api-secret-token" /// A middleware function to handle incoming requests from the Telegram API. /// Handles a request to the bot webhook endpoint, decodes the incoming message, diff --git a/src/telega/keyboard.gleam b/src/telega/keyboard.gleam index ec94828..0cfc1b4 100644 --- a/src/telega/keyboard.gleam +++ b/src/telega/keyboard.gleam @@ -159,9 +159,9 @@ pub opaque type KeyboardCallbackData(data) { pub type KeyboardCallback(data) { KeyboardCallback( + data: data, id: String, payload: String, - data: data, callback_data: KeyboardCallbackData(data), ) }