klappvisor / haskell-telegram-api

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

Optional field for Telegram #8

Closed josejuan closed 8 years ago

josejuan commented 8 years ago

Telegram no return some field (e.g. Message.from) and the client fail since is currently mandatory.

Should not be optional? (e.g. from :: Maybe User)

sendMessage (Token "bot01234567:ABCDEFGHIJK")
            (SendMessageRequest "-123456789"
                                "Hi World!"
                                (Just Markdown)
                                Nothing 
                                Nothing 
                                Nothing)

Left (DecodeFailure {decodeError = "The key \"from\" was not found", responseContentType = application/json, responseBody = "{\"ok\":true,\"result\":{\"message_id\":12,\"chat\":{\"id\":-123456789,\"title\":\"Bookingland Alerts\",\"type\":\"channel\"},\"date\":1461677951,\"text\":\"Hi World!\"}}"})

Great job and thank you!

klappvisor commented 8 years ago

@josejuan Thanks for reporting this issue! You are right, it should be optional. Currently I am away and have limited internet access, so pull request is highly appreciated!

josejuan commented 8 years ago

"pull request is highly appreciated!"

Of course! but this is a big change and it will break all other code (user api code too).

I don't know how to proceed here (maybe changing to a new version then do changes there).

klappvisor commented 8 years ago

@josejuan The major version of this package is still below 1, so don't worry. Yes, it may break others code, if they do not specify exact version of dependency, but as we can see code is alredy broken due to this issue. Thus I would not worry too much

josejuan commented 8 years ago

Done #9 I hope it is not too bad :)

klappvisor commented 8 years ago

version 0.3.0.0 has been released a few days ago. closing issue thank you @josejuan