telegram-s / telegram-bot

32 stars 23 forks source link

UpdateShortMessage on own message ? #3

Open Thus0 opened 10 years ago

Thus0 commented 10 years ago

With current level api, the bot doesn't seem to receive the messages sent by a user with same phone number registered : if I log in telegram with the same phone number, I cannot talk to my bot (for debug or test). So I need to have 2 phone numbers or ask someone else to write... If I undestand : https://core.telegram.org/constructor/updateShortMessage we can only receive messages from other contacts.

What's the best solution to develop and test ? Is there a way to distinguish real person and a bot (even if associated with same phone number for security reasons ?) and change the informations for the bot (avatar, ...). For example, after registering an app/bot with the form https://my.telegram.org/apps, we could have special credentials or a virtual phone number (linked to real phone number) so we can use it to authenticate the bot with the SMS code ? Or we could use the same mechanism as https://my.telegram.org/apps ie. receive the TLSEntCode by secure chat in telegram : so we don't need to have a second phone number.

Thanks

ex3ndr commented 10 years ago

Bot doesn't implemented correctly for now. Telegram Api have an idea about Update Sequence and all update messages (username changed, messages, etc...) are sent by server in special sequence. Sometimes this messages may be lost and we might to detect holes in sequence and calling manually getDifference. Also, we expected that clients in some situations call getDifference manually, for example in case when updateShortMessage arrived with unknown user, app might ignore this update and call getDifference. In a week i'll release new version of telegram api with correct update sequence processing. For now you could investigate update processing in Telegram S sources: https://github.com/ex3ndr/telegram/blob/master/app/src/main/java/org/telegram/android/core/background/UpdateProcessor.java