Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pinned message in chat stops bot to respond #15

Closed
volodalexey opened this issue Jan 19, 2019 · 10 comments
Closed

Pinned message in chat stops bot to respond #15

volodalexey opened this issue Jan 19, 2019 · 10 comments
Labels
bug Something isn't working

Comments

@volodalexey
Copy link
Contributor

I have telegram room with me (as a user) and bot. Bot has administration rights and can view all messages.
I use Airgram for bot in this room.
If I - as a user pin some message - then bot freezes itself and refuses to work futher. I do not see any error messages, and I do not see any update events in console too. Only restart bot helps...

@airgram airgram added the bug Something isn't working label Jan 20, 2019
@volodalexey
Copy link
Contributor Author

Also following might be related to this issue:
If I switch off Wi-Fi(internet) on my smartphone => add a couple of messages => switch Wi-Fi(internet) => messages are sending to my Telegram bot (which is always run on VPS server).
Result the same:

bot freezes itself and refuses to work futher. I do not see any error messages, and I do not see any update events in console too. Only restart bot helps..

@esindger
Copy link
Collaborator

I couldn't reproduce this issue. Bot keeps to receive updates when I pin or unpin messages. Can you create a repository with simple code which reproduce this behavior?

@volodalexey
Copy link
Contributor Author

Checked this again - I can reproduce the issue.
https://github.com/volodalexey/airgram-user-and-bot-test - updated repo.
Just setup the project (see README).
Then npm run build
Then npm run test and within 20 seconds try to pin some message in your test group (I pin message as a user from my Android smartphone)

@volodalexey
Copy link
Contributor Author

@esindger have you managed to reproduce this?

Bot keeps to receive updates

Yes looks like bot receives updates, however NewMessageUpdate is never generated after I pin message.
I connected airgram-debug to se the difference in two cases:
1 => start bot => user send "/start" => bot receive NewMessageUpdate => bot reply
2 => start bot => userpin some message => user send "/start" => bot freeze
And I see that in 1 case I get NewMessageUpdate, in 2 no.
I found difference in output here (maybe this will help):
1:

...
airgram verbose 14:48:57.243 [UpdatesHandler] [3] handle() "updateNewMessage" ...
updates.use // my output in console
updates.on // my output in console
airgram info    14:48:57.249 [Client] callApi() "messages.sendMessage" ... // bot sends response
...

2:

...
airgram verbose 14:49:15.620 [UpdatesHandler] [3] handle() "updateNewMessage" ...
airgram verbose 14:49:15.621 [UpdatesHandler] [3] handleUpdateState() detected a pts hole (17292 > 17294 + 1), wait for true pts +1ms
airgram verbose 14:49:15.621 [Updates] [5] handled "updates" for 0.003sec +0ms
airgram verbose 14:49:16.120 [MtpClient][1] sendLongPoll() call checkLongPoll() +499ms
airgram verbose 14:49:16.121 [MtpClient][1] checkLongPoll() send longPoll +1ms
airgram debug   14:49:16.121 [MtpSerializer] writeInt() 2459514271  2459514271 http_wait[id]:int +1ms
airgram debug   14:49:16.122 [MtpSerializer] writeInt() 500  500 http_wait[max_delay]:int +0ms
airgram debug   14:49:16.122 [MtpSerializer] writeInt() 150  150 http_wait[wait_after]:int +0ms
airgram debug   14:49:16.123 [MtpSerializer] writeInt() 25000  25000 http_wait[max_wait]:int +1ms
...

@volodalexey
Copy link
Contributor Author

What do I need to pull new version of airgram? I do not see any version change.

@volodalexey
Copy link
Contributor Author

I checked 0.1.14 and now bot works, however after "pin" => if user send some message => in bot I get this message without parent context (ctx.parent is undefined), and hense I can not detect some useful information.
Is there something I can do with this?

@airgram
Copy link
Collaborator

airgram commented Jan 29, 2019

Please check 0.1.15 version.

@volodalexey
Copy link
Contributor Author

volodalexey commented Jan 30, 2019

Checked with version 0.1.15 - I still can not get parent context after pin.
Next message event after pin does not have parent context.

@volodalexey
Copy link
Contributor Author

Sorry, problem is not in parent context. Will reply shortly.

@volodalexey
Copy link
Contributor Author

Ok. It works. Awesome!
I had to take into account that after pin I will receive two messages:

{ _: 'updateNewMessage',
  message:
   { _: 'messageService',
     ...
     action: { _: 'messageActionPinMessage' } },
  pts: 18881,
  pts_count: 0 }

{ _: 'updateNewMessage',
  message: { _: 'message', ... },
  pts: 18886,
  pts_count: 1 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants