reefstah / TelegramBotAPI

A Java 8 implementation of Telegram's bot API.
MIT License
8 stars 1 forks source link

Small suggestion and another small problem #2

Closed UnAfraid closed 9 years ago

UnAfraid commented 9 years ago

Hello again,

I went into a bit more usage and i've notice that some fields that are Optional are set to null rather then Optional.of(null) / Optional.empty() For example

Message.getFrom().getUsername()

getUsername() returns null rather then Optional in this case.

I tried also sendPhoto method and it resulted in Bad Gateway, i sniffed the connection to check if all is okay and it seems like it matches against the specifications of the API i couldn't find what's wrong with it.

Also you may implement a little listener for getting updates and notify on it upon received new update.

Thanks!

UnAfraid commented 9 years ago

Actually i just figured it out, am gonna do pull request now.

reefstah commented 9 years ago

Ok (:

UnAfraid commented 9 years ago

This sendPhoto problem is kinda weird. First it got fixed when i changed encodings to UTF-8, then i started throwing bad gateway again :O

reefstah commented 9 years ago

That's weird I have some integration tests that send a photo, but I assume your having issues with the caption? Also haven' t tested message with reply markup. Ah, I see the test is now failing very strange.

UnAfraid commented 9 years ago

No, i am using this method:

org.codespartans.telegram.bot.TelegramBot.sendPhoto(int, File)

It doesn't includes caption

I've included the pull request with charset changes here: https://github.com/Reefstah/TelegramBotAPI/pull/3

UnAfraid commented 9 years ago

Now mysteriously out of nowhere it started working again.

reefstah commented 9 years ago

Haha I was guessing a Telegram issue, but a friend tested for me with a Node project which worked fine and now the sendLocation is failing. ;d

UnAfraid commented 9 years ago

My friend is using PHP and for him it works just fine, while for me it wasn't, weird..

UnAfraid commented 9 years ago

Here's small example of my suggestion regarding the listener and updates handling https://gist.github.com/UnAfraid/4d708e14ccfc5c4066df

reefstah commented 9 years ago

Looks like an interesting addition, but I think people should decide for themselves on how to implement a listener or we should provide an additional dependency lib.

reefstah commented 9 years ago

Don't know if you already found the issue, but here it is. https://github.com/FasterXML/jackson-datatype-jdk8/issues/6

UnAfraid commented 9 years ago

Seems we're done with that, closing it, thanks!