2
votes

I am using Telegram bot API with AWS Lambda and Zappa.

Everything was working fine. Until I realised that bot's webhook is being called everytime whenever a message is sent by anyone in the group.

I want to limit this webhook requests, as Lambda allows for only 1 million calls which is sufficient if bot is invoked, but only when /commands are called.

As I have to pin and edit messages using bot, that's why administrator permission is must.

I just want my bot to respond only to /commands along with administrator rights.

Please help me in tackling this issue.

1

1 Answers

1
votes

I am assuming you added your bot to a Telegram group. In this case, the first thing that you need is group id. This should help: https://github.com/GabrielRF/telegram-id#web-group-id

And then you need to write a function that identifies the status of a chat member. You can do this using getChatMember method in Telegram Bots API. If the chat member's status is "creator" or "administrator" then the response is sent to that user.