klappvisor / haskell-telegram-api

Telegram Bot API for Haskell
BSD 3-Clause "New" or "Revised" License
202 stars 67 forks source link

[Help] Usage example #97

Closed pando85 closed 7 years ago

pando85 commented 7 years ago

I'm trying to get working a basic usage but when I tried to send a message my compiler crash:

src/Main.hs:21:18: error:
    • No instance for (Data.String.IsString ChatId)
        arising from the literal ‘"7055881"’
    • In the expression: "7055881"
      In an equation for ‘chatId’: chatId = "7055881"
      In an equation for ‘main’:
          main
            = do { manager <- newManager tlsManagerSettings;
                   let request = ...;
                   res <- sendMessage token request manager;
                   .... }
            where
                token = Token "botXXXXXXX"
                chatId = "XXXXXX"
                message
                  = "text *bold* _italic_ [github](github.com/klappvisor/haskell-telegram-api)"

I want some code to start learning this library, thanks in advance.

robinvd commented 7 years ago

Could you add the relevant code?

klappvisor commented 7 years ago

Thank you for spotting it. Readme is outdated at the moment. Try to change it to

chatId = ChatId 7055881

I will update readme a bit later.

pando85 commented 7 years ago

Thanks, could be good if you have a bot working with this library make a link in README. Thanks for all!

klappvisor commented 7 years ago

Good point, maybe I can deploy it to free heroku web worker...