How to read messages from Telegram group with bot

python-telegram-bottelegramtelegram-bot

I would like to connect a simple telegram bot to read messages from a group, (where I'm not admin). I already added the bot to the group, but it doesn't work.

Here is the code I have in Python:

import telepot
from pprint import pprint
import time
from telepot.loop import MessageLoop

key = "MY API"

bot = telepot.Bot(key)

def handle(msg):
   pprint(msg)

bot.message_loop(handle)

while 1:
   time.sleep(10)

If I open the chat (of the bot) and write a message, everything works well. But when someone send a message in a group (where I added the bot), even if the bot is in that group, nothing happen. What I'm doing wrong? Do I miss something?

Thanks a lot for the help!

Best Answer

You need to change /setprivacy to Disable, or you can only receive command (starts with /).

You can refer to here for more details.

Related Topic