如何通过 Telegram Bot 发送文件 [英] How to send File via Telegram Bot
本文介绍了如何通过 Telegram Bot 发送文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用 TelegramBot API 发送 txt 文件.
I need to send txt File using TelegramBot API .
并且有问题:
{"ok":false,"error_code":400,"description":"错误请求:错误的远程指定的文件 ID:错误的字符串长度"}
{"ok":false,"error_code":400,"description":"Bad Request: wrong remote file id specified: Wrong string length"}
推荐答案
为了完成 Donny 的回答,我想添加一个将 .txt
文件作为文档发送的示例.
To complete Donny's answer, I would like to add an example of sending .txt
file as a document.
看起来您使用 OS X 作为操作系统,其中预装了 curl
实用程序.
Looks like you're using OS X as an operating system, which has curl
utility preinstalled.
打开终端并发出这样的请求:
Open terminal and make a request like this:
curl -v -F "chat_id=569502265" -F document=@/Users/users/Desktop/file.txt https://api.telegram.org/bot<TOKEN>/sendDocument
这篇关于如何通过 Telegram Bot 发送文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文