通过 FILEID 发送文档

时间:2021-02-08 08:08:42

标签: python py-telegram-bot-api

我是 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() 得到一个意外的关键字参数 'document'

希望得到回复

1 个答案:

答案 0 :(得分:0)

只需将您的“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()