【发布时间】:2020-12-14 16:37:41
【问题描述】:
我制作了一个机器人,它使用 URL 从外部服务器发送文件。
我希望机器人直接从您的服务器发送文件。
我做错了什么?为什么open() 命令不起作用?
import telebot
bot = telebot.TeleBot("Token")
@bot.message_handler(commands=['start','help'])
def send_start_message(message):
bot.reply_to(message, "Hi.")
@bot.message_handler(func=lambda m: True)
def echo_all(message):
print(message.text)
duck = open('duck.png','r')
bot.send_photo(message.chat.id, duck)
bot.send_message(message.chat.id, "hi")
bot.polling()
【问题讨论】:
-
你得到什么错误信息?
标签: python telegram telegram-bot python-telegram-bot