rubenlagus / TelegramBotsExample

A simple to use library to create Telegram Bots in Java
GNU General Public License v3.0
484 stars 229 forks source link

API response format seems different from what library expects #22

Closed Pelumi closed 8 years ago

Pelumi commented 8 years ago

I'm using maven to add the library and I can successfully run the test echobot.

However, it doesn't echo the message back. The Update Object passed into the variable is:

Message{ messageId=7, from=User{ id=201714380, firstName='pelumi', lastName='null', userName='null' }, date=1461823588, chat=Chat{ id=201714380, type='private', title='null', firstName='pelumi', lastName='null', userName='null' }, forwardFrom=null, forwardDate=null, text='hey', audio=null, document=null, photo=null, sticker=null, video=null, contact=null, location=null, venue=null, newChatMember=null, leftChatMember=null, newChatTitle='null', newChatPhoto=null, deleteChatPhoto=null, groupchatCreated=null, replyToMessage=null, voice=null, superGroupCreated=null, channelChatCreated=null, migrateToChatId=null, migrateFromChatId=null }

As seen the Message object is not null which makes it enter the if case as expected. Conversely, the message object doesn't contain a property 'text'. Text is a property of the parent 'Update' object meaning the method if (message.Hastext()) return false.

My question is this, am I using the wrong (or un-updated) library or the response format just changed recently and the client needs to be updated?

I added the library using maven as seen below (added the repo and the actual dep):

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>com.github.rubenlagus</groupId>
        <artifactId>TelegramBots</artifactId>
        <version>V2.2</version>
    </dependency>
</dependencies>