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!
Your telegram bot should be the admin of group to be able to read messages of the group.
You need to change
/setprivacy
toDisable
, or you can only receive command (starts with/
).You can refer to here for more details.
This is an example in Telepot framework. You can do something like this in your favorite framework.