module Telegram.Bot.Simple.InlineKeyboard where

import           Data.Text        (Text)
import qualified Data.Text        as Text

import           Telegram.Bot.API

urlButton :: Text -> Text -> InlineKeyboardButton
urlButton :: Text -> Text -> InlineKeyboardButton
urlButton Text
label Text
url = (Text -> InlineKeyboardButton
labeledInlineKeyboardButton Text
label)
  { $sel:inlineKeyboardButtonUrl:InlineKeyboardButton :: Maybe Text
inlineKeyboardButtonUrl = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
url}

callbackButton :: Text -> Text -> InlineKeyboardButton
callbackButton :: Text -> Text -> InlineKeyboardButton
callbackButton Text
label Text
data_ = (Text -> InlineKeyboardButton
labeledInlineKeyboardButton Text
label)
  { $sel:inlineKeyboardButtonCallbackData:InlineKeyboardButton :: Maybe Text
inlineKeyboardButtonCallbackData = Text -> Maybe Text
forall a. a -> Maybe a
Just Text
data_}

actionButton :: Show action => Text -> action -> InlineKeyboardButton
actionButton :: Text -> action -> InlineKeyboardButton
actionButton Text
label = Text -> Text -> InlineKeyboardButton
callbackButton Text
label (Text -> InlineKeyboardButton)
-> (action -> Text) -> action -> InlineKeyboardButton
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Text
Text.pack (String -> Text) -> (action -> String) -> action -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. action -> String
forall a. Show a => a -> String
show