通过 FILEID 发送文档

问题描述

我是 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'

希望得到回复

解决方法

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