-
Notifications
You must be signed in to change notification settings - Fork 9
Add Telegram Bot API #239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add Telegram Bot API #239
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --ignore-all-space --minimal --new-file --recursive main/cli/generated/TelegramBotApi/Api.elm branch/cli/generated/TelegramBotApi/Api.elm
0a1,22050
> module TelegramBotApi.Api exposing
> ( addStickerToSet, addStickerToSetTask, answerCallbackQuery, answerCallbackQueryTask, answerInlineQuery, answerInlineQueryTask
> , answerPreCheckoutQuery, answerPreCheckoutQueryTask, answerShippingQuery, answerShippingQueryTask, answerWebAppQuery, answerWebAppQueryTask
> , approveChatJoinRequest, approveChatJoinRequestTask, approveSuggestedPost, approveSuggestedPostTask, banChatMember, banChatMemberTask
> , banChatSenderChat, banChatSenderChatTask, close, closeForumTopic, closeForumTopicTask, closeGeneralForumTopic
> , closeGeneralForumTopicTask, closeTask, convertGiftToStars, convertGiftToStarsTask, copyMessage, copyMessageTask
> , copyMessages, copyMessagesTask, createChatInviteLink, createChatInviteLinkTask, createChatSubscriptionInviteLink, createChatSubscriptionInviteLinkTask
> , createForumTopic, createForumTopicTask, createInvoiceLink, createInvoiceLinkTask, createNewStickerSet, createNewStickerSetTask
> , declineChatJoinRequest, declineChatJoinRequestTask, declineSuggestedPost, declineSuggestedPostTask, deleteBusinessMessages, deleteBusinessMessagesTask
> , deleteChatPhoto, deleteChatPhotoTask, deleteChatStickerSet, deleteChatStickerSetTask, deleteForumTopic, deleteForumTopicTask
> , deleteMessage, deleteMessageTask, deleteMessages, deleteMessagesTask, deleteMyCommands, deleteMyCommandsTask
> , deleteStickerFromSet, deleteStickerFromSetTask, deleteStickerSet, deleteStickerSetTask, deleteStory, deleteStoryTask
> , deleteWebhook, deleteWebhookTask, editChatInviteLink, editChatInviteLinkTask, editChatSubscriptionInviteLink, editChatSubscriptionInviteLinkTask
> , editForumTopic, editForumTopicTask, editGeneralForumTopic, editGeneralForumTopicTask, editMessageCaption, editMessageCaptionTask
> , editMessageChecklist, editMessageChecklistTask, editMessageLiveLocation, editMessageLiveLocationTask, editMessageMedia, editMessageMediaTask
> , editMessageReplyMarkup, editMessageReplyMarkupTask, editMessageText, editMessageTextTask, editStory, editStoryTask
> , editUserStarSubscription, editUserStarSubscriptionTask, exportChatInviteLink, exportChatInviteLinkTask, forwardMessage, forwardMessageTask
> , forwardMessages, forwardMessagesTask, getAvailableGifts, getAvailableGiftsTask, getBusinessAccountGifts, getBusinessAccountGiftsTask
> , getBusinessAccountStarBalance, getBusinessAccountStarBalanceTask, getBusinessConnection, getBusinessConnectionTask, getChat, getChatAdministrators
> , getChatAdministratorsTask, getChatGifts, getChatGiftsTask, getChatMember, getChatMemberCount, getChatMemberCountTask
> , getChatMemberTask, getChatMenuButton, getChatMenuButtonTask, getChatTask, getCustomEmojiStickers, getCustomEmojiStickersTask
> , getFile, getFileTask, getForumTopicIconStickers, getForumTopicIconStickersTask, getGameHighScores, getGameHighScoresTask
> , getMe, getMeTask, getMyCommands, getMyCommandsTask, getMyDefaultAdministratorRights, getMyDefaultAdministratorRightsTask
> , getMyDescription, getMyDescriptionTask, getMyName, getMyNameTask, getMyShortDescription, getMyShortDescriptionTask
> , getMyStarBalance, getMyStarBalanceTask, getStarTransactions, getStarTransactionsTask, getStickerSet, getStickerSetTask
> , getUpdates, getUpdatesTask, getUserChatBoosts, getUserChatBoostsTask, getUserGifts, getUserGiftsTask
> , getUserProfilePhotos, getUserProfilePhotosTask, getWebhookInfo, getWebhookInfoTask, giftPremiumSubscription, giftPremiumSubscriptionTask
> , hideGeneralForumTopic, hideGeneralForumTopicTask, leaveChat, leaveChatTask, logOut, logOutTask
> , pinChatMessage, pinChatMessageTask, postStory, postStoryTask, promoteChatMember, promoteChatMemberTask
> , readBusinessMessage, readBusinessMessageTask, refundStarPayment, refundStarPaymentTask, removeBusinessAccountProfilePhoto, removeBusinessAccountProfilePhotoTask
> , removeChatVerification, removeChatVerificationTask, removeUserVerification, removeUserVerificationTask, reopenForumTopic, reopenForumTopicTask
> , reopenGeneralForumTopic, reopenGeneralForumTopicTask, replaceStickerInSet, replaceStickerInSetTask, repostStory, repostStoryTask
> , restrictChatMember, restrictChatMemberTask, revokeChatInviteLink, revokeChatInviteLinkTask, savePreparedInlineMessage, savePreparedInlineMessageTask
> , sendAnimation, sendAnimationTask, sendAudio, sendAudioTask, sendChatAction, sendChatActionTask
> , sendChecklist, sendChecklistTask, sendContact, sendContactTask, sendDice, sendDiceTask
> , sendDocument, sendDocumentTask, sendGame, sendGameTask, sendGift, sendGiftTask
> , sendInvoice, sendInvoiceTask, sendLocation, sendLocationTask, sendMediaGroup, sendMediaGroupTask
> , sendMessage, sendMessageDraft, sendMessageDraftTask, sendMessageTask, sendPaidMedia, sendPaidMediaTask
> , sendPhoto, sendPhotoTask, sendPoll, sendPollTask, sendSticker, sendStickerTask
> , sendVenue, sendVenueTask, sendVideo, sendVideoNote, sendVideoNoteTask, sendVideoTask
> , sendVoice, sendVoiceTask, setBusinessAccountBio, setBusinessAccountBioTask, setBusinessAccountGiftSettings, setBusinessAccountGiftSettingsTask
> , setBusinessAccountName, setBusinessAccountNameTask, setBusinessAccountProfilePhoto, setBusinessAccountProfilePhotoTask, setBusinessAccountUsername, setBusinessAccountUsernameTask
> , setChatAdministratorCustomTitle, setChatAdministratorCustomTitleTask, setChatDescription, setChatDescriptionTask, setChatMenuButton, setChatMenuButtonTask
> , setChatPermissions, setChatPermissionsTask, setChatPhoto, setChatPhotoTask, setChatStickerSet, setChatStickerSetTask
> , setChatTitle, setChatTitleTask, setCustomEmojiStickerSetThumbnail, setCustomEmojiStickerSetThumbnailTask, setGameScore, setGameScoreTask
> , setMessageReaction, setMessageReactionTask, setMyCommands, setMyCommandsTask, setMyDefaultAdministratorRights, setMyDefaultAdministratorRightsTask
> , setMyDescription, setMyDescriptionTask, setMyName, setMyNameTask, setMyShortDescription, setMyShortDescriptionTask
> , setPassportDataErrors, setPassportDataErrorsTask, setStickerEmojiList, setStickerEmojiListTask, setStickerKeywords, setStickerKeywordsTask
> , setStickerMaskPosition, setStickerMaskPositionTask, setStickerPositionInSet, setStickerPositionInSetTask, setStickerSetThumbnail, setStickerSetThumbnailTask
> , setStickerSetTitle, setStickerSetTitleTask, setUserEmojiStatus, setUserEmojiStatusTask, setWebhook, setWebhookTask
> , stopMessageLiveLocation, stopMessageLiveLocationTask, stopPoll, stopPollTask, transferBusinessAccountStars, transferBusinessAccountStarsTask
> , transferGift, transferGiftTask, unbanChatMember, unbanChatMemberTask, unbanChatSenderChat, unbanChatSenderChatTask
> , unhideGeneralForumTopic, unhideGeneralForumTopicTask, unpinAllChatMessages, unpinAllChatMessagesTask, unpinAllForumTopicMessages, unpinAllForumTopicMessagesTask
> , unpinAllGeneralForumTopicMessages, unpinAllGeneralForumTopicMessagesTask, unpinChatMessage, unpinChatMessageTask, upgradeGift, upgradeGiftTask
> , uploadStickerFile, uploadStickerFileTask, verifyChat, verifyChatTask, verifyUser, verifyUserTask
> )
>
> {-|
>
>
> ## Operations
>
> @docs addStickerToSet, addStickerToSetTask, answerCallbackQuery, answerCallbackQueryTask, answerInlineQuery, answerInlineQueryTask
> @docs answerPreCheckoutQuery, answerPreCheckoutQueryTask, answerShippingQuery, answerShippingQueryTask, answerWebAppQuery, answerWebAppQueryTask
> @docs approveChatJoinRequest, approveChatJoinRequestTask, approveSuggestedPost, approveSuggestedPostTask, banChatMember, banChatMemberTask
> @docs banChatSenderChat, banChatSenderChatTask, close, closeForumTopic, closeForumTopicTask, closeGeneralForumTopic
> @docs closeGeneralForumTopicTask, closeTask, convertGiftToStars, convertGiftToStarsTask, copyMessage, copyMessageTask
> @docs copyMessages, copyMessagesTask, createChatInviteLink, createChatInviteLinkTask, createChatSubscriptionInviteLink, createChatSubscriptionInviteLinkTask
> @docs createForumTopic, createForumTopicTask, createInvoiceLink, createInvoiceLinkTask, createNewStickerSet, createNewStickerSetTask
> @docs declineChatJoinRequest, declineChatJoinRequestTask, declineSuggestedPost, declineSuggestedPostTask, deleteBusinessMessages, deleteBusinessMessagesTask
> @docs deleteChatPhoto, deleteChatPhotoTask, deleteChatStickerSet, deleteChatStickerSetTask, deleteForumTopic, deleteForumTopicTask
> @docs deleteMessage, deleteMessageTask, deleteMessages, deleteMessagesTask, deleteMyCommands, deleteMyCommandsTask
> @docs deleteStickerFromSet, deleteStickerFromSetTask, deleteStickerSet, deleteStickerSetTask, deleteStory, deleteStoryTask
> @docs deleteWebhook, deleteWebhookTask, editChatInviteLink, editChatInviteLinkTask, editChatSubscriptionInviteLink, editChatSubscriptionInviteLinkTask
> @docs editForumTopic, editForumTopicTask, editGeneralForumTopic, editGeneralForumTopicTask, editMessageCaption, editMessageCaptionTask
> @docs editMessageChecklist, editMessageChecklistTask, editMessageLiveLocation, editMessageLiveLocationTask, editMessageMedia, editMessageMediaTask
> @docs editMessageReplyMarkup, editMessageReplyMarkupTask, editMessageText, editMessageTextTask, editStory, editStoryTask
> @docs editUserStarSubscription, editUserStarSubscriptionTask, exportChatInviteLink, exportChatInviteLinkTask, forwardMessage, forwardMessageTask
> @docs forwardMessages, forwardMessagesTask, getAvailableGifts, getAvailableGiftsTask, getBusinessAccountGifts, getBusinessAccountGiftsTask
> @docs getBusinessAccountStarBalance, getBusinessAccountStarBalanceTask, getBusinessConnection, getBusinessConnectionTask, getChat, getChatAdministrators
> @docs getChatAdministratorsTask, getChatGifts, getChatGiftsTask, getChatMember, getChatMemberCount, getChatMemberCountTask
> @docs getChatMemberTask, getChatMenuButton, getChatMenuButtonTask, getChatTask, getCustomEmojiStickers, getCustomEmojiStickersTask
> @docs getFile, getFileTask, getForumTopicIconStickers, getForumTopicIconStickersTask, getGameHighScores, getGameHighScoresTask
> @docs getMe, getMeTask, getMyCommands, getMyCommandsTask, getMyDefaultAdministratorRights, getMyDefaultAdministratorRightsTask
> @docs getMyDescription, getMyDescriptionTask, getMyName, getMyNameTask, getMyShortDescription, getMyShortDescriptionTask
> @docs getMyStarBalance, getMyStarBalanceTask, getStarTransactions, getStarTransactionsTask, getStickerSet, getStickerSetTask
> @docs getUpdates, getUpdatesTask, getUserChatBoosts, getUserChatBoostsTask, getUserGifts, getUserGiftsTask
> @docs getUserProfilePhotos, getUserProfilePhotosTask, getWebhookInfo, getWebhookInfoTask, giftPremiumSubscription, giftPremiumSubscriptionTask
> @docs hideGeneralForumTopic, hideGeneralForumTopicTask, leaveChat, leaveChatTask, logOut, logOutTask
> @docs pinChatMessage, pinChatMessageTask, postStory, postStoryTask, promoteChatMember, promoteChatMemberTask
> @docs readBusinessMessage, readBusinessMessageTask, refundStarPayment, refundStarPaymentTask, removeBusinessAccountProfilePhoto, removeBusinessAccountProfilePhotoTask
> @docs removeChatVerification, removeChatVerificationTask, removeUserVerification, removeUserVerificationTask, reopenForumTopic, reopenForumTopicTask
> @docs reopenGeneralForumTopic, reopenGeneralForumTopicTask, replaceStickerInSet, replaceStickerInSetTask, repostStory, repostStoryTask
> @docs restrictChatMember, restrictChatMemberTask, revokeChatInviteLink, revokeChatInviteLinkTask, savePreparedInlineMessage, savePreparedInlineMessageTask
> @docs sendAnimation, sendAnimationTask, sendAudio, sendAudioTask, sendChatAction, sendChatActionTask
> @docs sendChecklist, sendChecklistTask, sendContact, sendContactTask, sendDice, sendDiceTask
> @docs sendDocument, sendDocumentTask, sendGame, sendGameTask, sendGift, sendGiftTask
> @docs sendInvoice, sendInvoiceTask, sendLocation, sendLocationTask, sendMediaGroup, sendMediaGroupTask
> @docs sendMessage, sendMessageDraft, sendMessageDraftTask, sendMessageTask, sendPaidMedia, sendPaidMediaTask
> @docs sendPhoto, sendPhotoTask, sendPoll, sendPollTask, sendSticker, sendStickerTask
> @docs sendVenue, sendVenueTask, sendVideo, sendVideoNote, sendVideoNoteTask, sendVideoTask
> @docs sendVoice, sendVoiceTask, setBusinessAccountBio, setBusinessAccountBioTask, setBusinessAccountGiftSettings, setBusinessAccountGiftSettingsTask
> @docs setBusinessAccountName, setBusinessAccountNameTask, setBusinessAccountProfilePhoto, setBusinessAccountProfilePhotoTask, setBusinessAccountUsername, setBusinessAccountUsernameTask
> @docs setChatAdministratorCustomTitle, setChatAdministratorCustomTitleTask, setChatDescription, setChatDescriptionTask, setChatMenuButton, setChatMenuButtonTask
> @docs setChatPermissions, setChatPermissionsTask, setChatPhoto, setChatPhotoTask, setChatStickerSet, setChatStickerSetTask
> @docs setChatTitle, setChatTitleTask, setCustomEmojiStickerSetThumbnail, setCustomEmojiStickerSetThumbnailTask, setGameScore, setGameScoreTask
> @docs setMessageReaction, setMessageReactionTask, setMyCommands, setMyCommandsTask, setMyDefaultAdministratorRights, setMyDefaultAdministratorRightsTask
> @docs setMyDescription, setMyDescriptionTask, setMyName, setMyNameTask, setMyShortDescription, setMyShortDescriptionTask
> @docs setPassportDataErrors, setPassportDataErrorsTask, setStickerEmojiList, setStickerEmojiListTask, setStickerKeywords, setStickerKeywordsTask
> @docs setStickerMaskPosition, setStickerMaskPositionTask, setStickerPositionInSet, setStickerPositionInSetTask, setStickerSetThumbnail, setStickerSetThumbnailTask
> @docs setStickerSetTitle, setStickerSetTitleTask, setUserEmojiStatus, setUserEmojiStatusTask, setWebhook, setWebhookTask
> @docs stopMessageLiveLocation, stopMessageLiveLocationTask, stopPoll, stopPollTask, transferBusinessAccountStars, transferBusinessAccountStarsTask
> @docs transferGift, transferGiftTask, unbanChatMember, unbanChatMemberTask, unbanChatSenderChat, unbanChatSenderChatTask
> @docs unhideGeneralForumTopic, unhideGeneralForumTopicTask, unpinAllChatMessages, unpinAllChatMessagesTask, unpinAllForumTopicMessages, unpinAllForumTopicMessagesTask
> @docs unpinAllGeneralForumTopicMessages, unpinAllGeneralForumTopicMessagesTask, unpinChatMessage, unpinChatMessageTask, upgradeGift, upgradeGiftTask
> @docs uploadStickerFile, uploadStickerFileTask, verifyChat, verifyChatTask, verifyUser, verifyUserTask
>
> -}
>
> import Bytes
> import Dict
> import Http
> import Json.Decode
> import Json.Encode
> import OpenApi.Common
> import Task
> import TelegramBotApi.Json
> import TelegramBotApi.Types
> import Url.Builder
>
>
> {-| Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns _True_ on success.
> -}
> addStickerToSet config =
> Http.request
> { url =
> Url.Builder.crossOrigin
> "https://api.telegram.org/bot{token}"
> [ "addStickerToSet" ]
> []
> , method = "POST"
> , headers = []
> , expect =
> OpenApi.Common.expectJsonCustom
> (Dict.fromList
> [ ( "default", TelegramBotApi.Json.decodeError ) ]
> )
> (Json.Decode.succeed
> (\ok result -> { ok = ok, result = result })
> |> OpenApi.Common.jsonDecodeAndMap
> (Json.Decode.field "ok" Json.Decode.bool)
> |> OpenApi.Common.jsonDecodeAndMap
> (Json.Decode.field
> "result"
> Json.Decode.bool
> )
> )
> config.toMsg
> , body = Http.bytesBody "multipart/form-data" config.body
> , timeout = Nothing
> , tracker = Nothing
> }
>
>
> {-| Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns _True_ on success.
> -}
> addStickerToSetTask :
> { body : Bytes.Bytes }
> ->
> Task.Task
> (OpenApi.Common.Error TelegramBotApi.Types.Error String)
> { ok :
> Bool
> , result : Bool
> }
> addStickerToSetTask config =
> Http.task
> { url =
> Url.Builder.crossOrigin
> "https://api.telegram.org/bot{token}"
> [ "addStickerToSet" ]
> []
> , method = "POST"
> , headers = []
> , resolver =
> OpenApi.Common.jsonResolverCustom
> (Dict.fromList
> [ ( "default", TelegramBotApi.Json.decodeError ) ]
> )
> (Json.Decode.succeed
> (\ok result -> { ok = ok, result = result })
> |> OpenApi.Common.jsonDecodeAndMap
> (Json.Decode.field "ok" Json.Decode.bool)
> |> OpenApi.Common.jsonDecodeAndMap
> (Json.Decode.field
> "result"
> Json.Decode.bool
> )
> )
> , body = Http.bytesBody "multipart/form-data" config.body
> , timeout = Nothing
> }
>
>
> {-| Use this method to send answers to callback queries sent from [inline keyboards](https://core.telegram.org/bots/features#inline-keyboards). The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, _True_ is returned.
>
> Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via [@BotFather](https://t.me/botfather) and accept the terms. Otherwise, you may use links like `t.me/your_bot?start=XXXX` that open your bot with a parameter.
>
> -}
> answerCallbackQuery :
> { toMsg :
> Result
> (OpenApi.Common.Error TelegramBotApi.Types.Error String)
> { ok :
> Bool
> , result : Bool
> }
> -> msg
> , body :
> { cache_time : Maybe Int
> , callback_query_id : String
> , show_alert : Maybe Bool
> , text : Maybe String
> , url : Maybe String
> }
> }
> -> Cmd msg
> answerCallbackQuery config =
> Http.request
> { url =
> Url.Builder.crossOrigin
> "https://api.telegram.org/bot{token}"
> [ "answerCallbackQuery" ]
> []
> , method = "POST"
> , headers = []
> , expect =
> OpenApi.Common.expectJsonCustom
> (Dict.fromList
> [ ( "default", TelegramBotApi.Json.decodeError ) ]
> )
> (Json.Decode.succeed
> (\ok result -> { ok = ok, result = result })
> |> OpenApi.Common.jsonDecodeAndMap
> (Json.Decode.field "ok" Json.Decode.bool)
> |> OpenApi.Common.jsonDecodeAndMap
> (Json.Decode.field
> "result"
> Json.Decode.bool
> )
> )
> config.toMsg
> , body =
> Http.jsonBody
> (Json.Encode.object
> (List.filterMap
> Basics.identity
> [ Maybe.map
> (\mapUnpack ->
> ( "cache_time", Json.Encode.int mapUnpack )
> )
> config.body.cache_time
> , Just
> ( "callback_query_id"
> , Json.Encode.string config.body.callback_query_id
> )
> , Maybe.map
> (\mapUnpack ->
> ( "show_alert", Json.Encode.bool mapUnpack )
> )
> config.body.show_alert
> , Maybe.map
> (\mapUnpack ->
> ( "text", Json.Encode.string mapUnpack )
> )
> config.body.text
> , Maybe.map
> (\mapUnpack ->
> ( "url", Json.Encode.string mapUnpack )
> )
> config.body.url
> ]
> )
> )
> , timeout = Nothing
> , tracker = Nothing
> }
>
>
> {-| Use this method to send answers to callback queries sent from [inline keyboards](https://core.telegram.org/bots/features#inline-keyboards). The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, _True_ is returned.
>
> Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via [@BotFather](https://t.me/botfather) and accept the terms. Otherwise, you may use links like `t.me/your_bot?start=XXXX` that open your bot with a parameter.
>
> -}
> answerCallbackQueryTask :
> { body :
> { cache_time : Maybe Int
> , callback_query_id : String
> , show_alert : Maybe Bool
> , text : Maybe String
> , url : Maybe String
> }
> }
> ->
> Task.Task
> (OpenApi.Common.Error TelegramBotApi.Types.Error String)
> { ok :
> Bool
> , result : Bool
> }
> answerCallbackQueryTask config =
> Http.task
> { url =
> Url.Builder.crossOrigin
> "https://api.telegram.org/bot{token}"
> [ "answerCallbackQuery" ]
> []
> , method = "POST"
> , headers = []
> , resolver =
> OpenApi.Common.jsonResolverCustom
> (Dict.fromList
> [ ( "default", TelegramBotApi.Json.decodeError ) ]
> )
> (Json.Decode.succeed
> (\ok result -> { ok = ok, result = result })
> |> OpenApi.Common.jsonDecodeAndMap
> (Json.Decode.field "ok" Json.Decode.bool)
> |> OpenApi.Common.jsonDecodeAndMap
> (Json.Decode.field
> "result"
> Json.Decode.bool
> )
> )
> , body =
> Http.jsonBody
> (Json.Encode.object
> (List.filterMap
> Basics.identity
> [ Maybe.map
> (\mapUnpack ->
> ( "cache_time", Json.Encode.int mapUnpack )
> )
> config.body.cache_time
> , Just
> ( "callback_query_id"
> , Json.Encode.string config.body.callback_query_id
> )
> , Maybe.map
> (\mapUnpack ->
> ( "show_alert", Json.Encode.bool mapUnpack )
> )
> config.body.show_alert
> , Maybe.map
> (\mapUnpack ->
> ( "text", Json.Encode.string mapUnpack )
> )
> config.body.text
> , Maybe.map
> (\mapUnpack ->
> ( "url", Json.Encode.string mapUnpack )
> )
> config.body.url
> ]
> )
> )
> , timeout = Nothing
> }
>
>
> {-| Use this method to send answers to an inline query. On success, _True_ is returned.
> No more than **50** results per query are allowed.
> -}
> answerInlineQuery :
> { toMsg :
> Result
> (OpenApi.Common.Error TelegramBotApi.Types.Error String)
> { ok :
> Bool
> , result : Bool
> }
> -> msg
> , body :
> { button : Maybe TelegramBotApi.Types.InlineQueryResultsButton
> , cache_time : Maybe Int
> , inline_query_id : String
> , is_personal : Maybe Bool
> , next_offset : Maybe String
> , results : List TelegramBotApi.Types.InlineQueryResult
> }
> }
> -> Cmd msg
> answerInlineQuery config =
> Http.request
> { url =
> Url.Builder.crossOrigin
> "https://api.telegram.org/bot{token}"
> [ "answerInlineQuery" ]
> []
> , method = "POST"
> , headers = []
> , expect =
> OpenApi.Common.expectJsonCustom
> (Dict.fromList
> [ ( "default", TelegramBotApi.Json.decodeError ) ]
> )
> (Json.Decode.succeed
> (\ok result -> { ok = ok, result = result })
> |> OpenApi.Common.jsonDecodeAndMap
> (Json.Decode.field "ok" Json.Decode.bool)
> |> OpenApi.Common.jsonDecodeAndMap
> (Json.Decode.field
> "result"
> Json.Decode.bool
> )
> )
> config.toMsg
> , body =
> Http.jsonBody
> (Json.Encode.object
> (List.filterMap
> Basics.identity
> [ Maybe.map
> (\mapUnpack ->
> ( "button"
> , TelegramBotApi.Json.encodeInlineQueryResultsButton
> mapUnpack
> )
> )
> config.body.button
> , Maybe.map
> (\mapUnpack ->
> ( "cache_time", Json.Encode.int mapUnpack )
> )
> config.body.cache_time
> , Just
> ( "inline_query_id"
> , Json.Encode.string config.body.inline_query_id
> )
> , Maybe.map
> (\mapUnpack ->
> ( "is_personal", Json.Encode.bool mapUnpack )
> )
> config.body.is_personal
> , Maybe.map
> (\mapUnpack ->
> ( "next_offset", Json.Encode.string mapUnpack )
> )
> config.body.next_offset
> , Just
> ( "results"
> , Json.Encode.list
> TelegramBotApi.Json.encodeInlineQueryResult
> config.body.results
> )
> ]
> )
> )
> , timeout = Nothing
> , tracker = Nothing
> }
>
>
> {-| Use this method to send answers to an inline query. On success, _True_ is returned.
> No more than **50** results per query are allowed.
> -}
> answerInlineQueryTask :
> { body :
> { button : Maybe TelegramBotApi.Types.InlineQueryResultsButton
> , cache_time : Maybe Int
> , inline_query_id : String
> , is_personal : Maybe Bool
> , next_offset : Maybe String
> , results : List TelegramBotApi.Types.InlineQueryResult
> }
> }
> ->
> Task.Task
> (OpenApi.Common.Error TelegramBotApi.Types.Error String)
> { ok :
> Bool
> , result : Bool
> }
> answerInlineQueryTask config =
> Http.task
> { url =
> Url.Builder.crossOrigin
> "https://api.telegram.org/bot{token}"
> [ "answerInlineQuery" ]
> []
> , method = "POST"
> , headers = []
> , resolver =
> OpenApi.Common.jsonResolverCustom
> (Dict.fromList
> [ ( "default", TelegramBotApi.Json.decodeError ) ]
> )
> (Json.Decode.succeed
> (\ok result -> { ok = ok, result = result })
> |> OpenApi.Common.jsonDecodeAndMap
> (Json.Decode.field "ok" Json.Decode.bool)
> |> OpenApi.Common.jsonDecodeAndMap
> (Json.Decode.field
> "result"
> Json.Decode.bool
> )
> )
> , body =
> Http.jsonBody
> (Json.Encode.object
> (List.filterMap
> Basics.identity
> [ Maybe.map
> (\mapUnpack ->
> ( "button"
> , TelegramBotApi.Json.encodeInlineQueryResultsButton
> mapUnpack
> )
> )
> config.body.button
> , Maybe.map
> (\mapUnpack ->
> ( "cache_time", Json.Encode.int mapUnpack )
> )
> config.body.cache_time
> , Just
> ( "inline_query_id"
> , Js |
wolfadex
approved these changes
Jan 16, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.