jehy / telegram-test-api

Simple implimentation of telegram API which can be used for testing telegram bots
MIT License
98 stars 24 forks source link

Make webhooks work with user's commands and callback queries #49

Closed RB-Lab closed 3 years ago

RB-Lab commented 3 years ago

Hello! I want to use telegram-test-api to test my Telegram-related project, which heavily relies on webhooks. While been working on tests I've noticed that telegram-test-api:

  1. Doesn't trigger webhooks on commands and callback queries,
  2. Sends updates on user's messages in wrong format (updateId instead of update_id etc.).

In this PR I've:

  1. Covered actual webhook triggering with tests,
  2. Extracted common part of update handling in "private" method and used it in all three cases (for messages, commands and callback queries),
  3. Extracted update formatting and used it in both /getUpdates and webhook handling.

NOTE First two commits contain only fixes of npm audit and npm run lint commands.

jehy commented 3 years ago

Привет! Видел пулл рек, но пока что не было времени посмотреть, гляну после выходных.

RB-Lab commented 3 years ago

Ok. Там у меня ещё 3 на подходе. =)

jehy commented 3 years ago

@RB-Lab по хорошему, надо это добро переписать на TS, если будет желание - будет круто.

RB-Lab commented 3 years ago

Да.. я уже подумывал об этом. На следующей неделе, может будет время.