-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
157 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,43 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE DeriveGeneric #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE TypeOperators #-} | ||
module Telegram.Bot.API.UpdatingMessages where | ||
|
||
import Data.Aeson | ||
import Data.Proxy | ||
import Data.Text (Text) | ||
import GHC.Generics (Generic) | ||
import Servant.API | ||
import Servant.Client (ClientM, client) | ||
|
||
import Telegram.Bot.API.Internal.Utils (gparseJSON, gtoJSON) | ||
import Telegram.Bot.API.MakingRequests | ||
import Telegram.Bot.API.Methods | ||
import Telegram.Bot.API.Types | ||
|
||
-- ** 'editMessageText' | ||
|
||
type EditMessageText | ||
= "editMessageText" | ||
:> ReqBody '[JSON] EditMessageTextRequest | ||
:> Post '[JSON] (Response Message) | ||
|
||
-- | Use this method to send text messages. | ||
-- On success, the sent 'Message' is returned. | ||
editMessageText :: EditMessageTextRequest -> ClientM (Response Message) | ||
editMessageText = client (Proxy @EditMessageText) | ||
|
||
-- | Request parameters for 'sendMessage'. | ||
data EditMessageTextRequest = EditMessageTextRequest | ||
{ editMessageTextChatId :: Maybe SomeChatId -- ^ Required if 'editMessageTextInlineMessageId' is not specified. Unique identifier for the target chat or username of the target channel (in the format @\@channelusername@). | ||
, editMessageTextMessageId :: Maybe MessageId -- ^ Required if 'editMessageTextInlineMessageId' is not specified. Identifier of the sent message. | ||
, editMessageTextInlineMessageId :: Maybe MessageId -- ^ Required if 'editMessageTextChatId' and 'editMessageTextMessageId' are not specified. Identifier of the sent message. | ||
, editMessageTextText :: Text -- ^ Text of the message to be sent. | ||
, editMessageTextParseMode :: Maybe ParseMode -- ^ Send 'Markdown' or 'HTML', if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message. | ||
, editMessageTextDisableWebPagePreview :: Maybe Bool -- ^ Disables link previews for links in this message. | ||
, editMessageTextReplyMarkup :: Maybe SomeReplyMarkup -- ^ Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. | ||
} deriving (Generic) | ||
|
||
instance ToJSON EditMessageTextRequest where toJSON = gtoJSON | ||
instance FromJSON EditMessageTextRequest where parseJSON = gparseJSON |
This file contains 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