Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import telebot
- import sys
- import time
- import os
- import requests
- import shutil
- API_TOKEN = "138599838:AAH_vFfAUqsIo71E3l6Ciqra0ZdBQ8yjHu4"
- bot = telebot.TeleBot("138599838:AAH_vFfAUqsIo71E3l6Ciqra0ZdBQ8yjHu4")
- administrador = 22784456
- bot.send_message(administrador, "Bot started.")
- def listener(msg):
- for m in msg:
- if m.content_type == "photo":
- cid = m.chat.id
- print cid
- fileid = m.photo[0].file_id
- print fileid
- file_info = bot.get_file(fileid)
- print file_info
- with open("photo3.jpg","wb",0) as download:
- filedown = requests.get('https://api.telegram.org/file/bot{0}/{1}'.format(API_TOKEN, file_info.file_path))
- for chunk in filedown.iter_content():
- download.write(chunk)
- download.close()
- if m.content_type == "text":
- cid = m.chat.id
- bot.send_message(cid, "BOT OK!")
- bot.set_update_listener(listener)
- bot.polling(none_stop=False,interval=1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement