【问题标题】:send document by FILEID通过 FILEID 发送文件
【发布时间】:2021-02-08 08:08:42
【问题描述】:

我是 python 新手,我想通过 file_id 发送文档,但我不知道这有什么问题,这就是我所做的 :)

import telebot

tb = telebot.TeleBot('bot-token')

@tb.message_handler(commands=['r'])
def send_document(message):
        tb.send_document(message.chat.id,document = "file_id")
tb.polling()

这是我得到的错误

TypeError: send_document() 得到了一个意外的关键字参数“文档”

希望得到回应

【问题讨论】:

    标签: python py-telegram-bot-api


    【解决方案1】:

    只要把你的“fileid”放在没有“document=”的地方

    这样做

    import telebot
    
    tb = telebot.TeleBot('bot-token')
    
    @tb.message_handler(commands=['r'])
    def send_document(message):
            tb.send_document(message.chat.id,"file_id")
    tb.polling()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-16
      • 2015-01-26
      • 2017-05-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多