Search code examples
pythontelegramtelegram-bot

pytelegrambotapi check bot is member of group


what is the best way to find out if the bot is the member of a Telegram group using pytelegrambotapi?

bot.send_message(GroupID,"test") 

it returns an error if bot is not in the group but i don't want check it this way


Solution

  • 1: Get the bot ID.

    2: Get the chat ID of the group.

    3: Check if the bot is a chat member using "getChatMember" or "getDefaultAdmninistratorRights".