【发布时间】:2021-01-24 17:20:46
【问题描述】:
import telebot
import urllib.request
import pyautogui
bot = telebot.TeleBot("TOKEN", parse_mode=None)
@bot.message_handler('start')
def send_welcome(message):
bot.reply_to(message, "Hi Wellcome To Server Manager Bot")
enter code here
@bot.message_handler('getip')
def send_targetip(message):
target_ip = urllib.request.urlopen("http://ip.42.pl/short")
ip = target_ip.read()
bot.reply_to(message,ip)
@bot.message_handler('screen')
def capture_screen(send_photo):
screenimage = pyautogui.screenshot("screen.png")
screenimage.save("C:\\Users\\HO3IN\\Desktop\\screen.png")
photo = open("C:\\Users\\user\\Desktop\\screen.png",'rb')
bot.send_photo(capture_screen,photo)
photo.close()
bot.polling()
我无法从机器人发送屏幕截图,显示此错误:
init.py:515 MainThread) 错误 - TeleBot:“对 Telegram API 的请求不成功。错误代码:400。描述:错误 请求:未找到聊天”
【问题讨论】:
标签: python telegram-bot