Bot API是一个基于HTTP的界面,专为那些热衷于为Telegram构建机器人的开发人员而设计,Telegram是一个带有文档API的即时消息应用程序。如果您正在编写电报机器人并且有关于Bot API的特定问题,请使用此标记。
我有一个用 Telegraf.js 编写的电报商店机器人。 当普通用户启动机器人时,我希望人们只看到 4 个按钮(产品、购物车、帐户和信息) 相反,当有人启动 bo...
拨号tcp:查找api.telegram.org:没有这样的主机恐慌:运行时错误
我试图制作一个电报机器人并收到此错误 - 发布“https://api.telegram.org/botxxxxxxxxxxxxx/getMe”:拨打 tcp:查找 api.telegram.org:没有这样的主机 恐慌:运行时呃...
我怎么不能 pip install python telegram bot
pip:术语“pip”不被识别为 cmdlet、函数、脚本文件的名称, 或可运行的程序。检查名称的拼写,或者如果包含路径,请验证 路径是正确的...
我有一个处理付款的 Telegram 机器人。付款正常进行,但是,付款成功后我无法出示收据。 当前的行为是: 用户点击“付款”
我有一个运行良好的机器人,我在其中设置了 webHooks 来向我发送更新。直到今天它对我来说一直工作得很好。我对我的代码做了一些非常小的调整,但发现即使我发送文本...
我是新来的,我正在使用 ESP32 和一些传感器制作一个项目。所以基本上我想创建一个简单的温度和门传感器,通过 Telegram 连接到互联网。 我想要我的 es...
网站上已设置了一个表单,其中的数据将发送到电报机器人。 PHP脚本是这样的 网站上已设置了一个表格,其中的数据将发送到电报机器人。 PHP脚本是这样的 <?php echo $TOKEN; error_reporting(E_ALL); ini_set('display_errors', 1); require 'vendor/autoload.php'; use Dotenv\Dotenv; // Specify the path to the directory where the .env file is located $dotenvPath = __DIR__; // Create an instance of Dotenv and load environment variables $dotenv = Dotenv::createImmutable(dirname(__DIR__)); $dotenv->load(); // Get the token value $TOKEN = $_ENV['TOKEN']; // Telegram bot token and channel ID $TELEGRAM_CHAT_ID = "-1002017740876"; // Check for the presence of a POST request if ($_SERVER["REQUEST_METHOD"] == "POST") { // Collect data from the form $product = $_POST['product']; $name = $_POST['name']; $phone = $_POST['phone']; $email = $_POST['email']; $attachments = $_FILES['attachments']; $invoice = $_FILES['invoice']; // Save data to the database or file (depends on your requirements) // Send notification to Telegram $message = "<b>Promindustry</b>\n"; $message .= "<b>Product Name: </b>".$product." \n"; $message .= "<b>Sender: </b>".$name." \n"; $message .= "<b>Phone: </b>".$phone." \n"; $message .= "<b>Email: </b>".$email; file_get_contents("https://api.telegram.org/bot$TOKEN/sendMessage?chat_id=$TELEGRAM_CHAT_ID&parse_mode=html&text=".urlencode($message)); // Function to send a file to Telegram function sendFileToTelegram($document, $caption = '') { global $TOKEN, $TELEGRAM_CHAT_ID; $url = "https://api.telegram.org/bot$TOKEN/sendDocument"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, [ 'chat_id' => $TELEGRAM_CHAT_ID, 'document' => new CURLFile($document['tmp_name'], $document['type'], $document['name']), 'caption' => $caption ]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $server_output = curl_exec($ch); curl_close($ch); } // Send files to Telegram if ($attachments['error'] == UPLOAD_ERR_OK) { sendFileToTelegram($attachments, 'Attachment: Signboard, part photo, other information'); } if ($invoice['error'] == UPLOAD_ERR_OK) { sendFileToTelegram($invoice, 'Attachment: Details for invoicing'); } // Send a response to the client (e.g., JSON response) echo json_encode([ "status" => "success", "message" => "Form submitted successfully!", ]); } else { // Send a response to the client about the invalid request method echo json_encode(["status" => "error", "message" => "Invalid request method!"]); } ?> 问题是只要文件大小小于 50 KB,一切都可以正常工作。一旦文件较大,就不会发送表格。 我将非常感谢您帮助解决这个问题。 我尝试重做脚本 此类行为最可能的原因可能是您的 php.ini 配置。 请找到您的 php.ini 文件并根据您的要求编辑这两行。 upload_max_filesize = 64M (change size as per your project requirement) post_max_size = 64M 还验证 telegram api 的文件限制(如果有)
如何让我的 Telegram 自动转发机器人在不引用的情况下转发?
我有一个机器人,可以自动将消息从通道 A 转发到组 B,并且我使用 Node.js 创建了这个机器人。机器人转发消息但显示它正在引用,我怎样才能让它显示为...
user_id 在函数调用后取值 None(telebot、sqlite3)
我正在使用远程机器人库制作一个电报机器人。该函数从 SQL3 数据库中检索用户先前在 city_living 变量中选择的居住城市。 定义
所以我花了几个月的时间来创建一个编辑器插件并对其进行验证。它现在以“未列出”的形式发布,但是,我无法让一些关键元素发挥作用。希望有人...
我们正在使用格莱美库开发一个 Telegram 机器人,并且遇到了一个问题:当尝试使用格莱美文档中的 sendAnimation 方法发送 GIF 文件时,它们被
使用 Telebot 停止 Telegram 机器人回调时出错
我正在使用 Python 中的 Telebot 库开发 Telegram 机器人。该机器人有一个主菜单,其中包含两个命令:/cep 和 /person。使用/cep命令时,用户必须输入邮政编码才能获取
我是 Python 新手,并且已使用 python-telegram-bot 库成功创建了一个 Python 机器人。此外,我还使用 Telethon 库编写了一个简单的脚本来收集统计信息
为什么机器人不发送消息? 我的代码: 导入电报 导入请求 bot_token = '令牌***' my_bot = telegram.Bot(token=bot_token) def get_chat_id(bot_token): request = requests.post(f'http...
Telegram 机器人发送的文件大小限制为 50MB。 我需要发送大文件。有没有办法解决? 我知道这个项目 https://github.com/pwrtelegram/pwrtelegram 但我可以......
这是我在该平台上的第一篇文章。我想要完成一项任务,并且需要有关如何实现它的建议。 我的电报帐户与数千人进行了数千次聊天......
Telegram bot api:sendPhoto 不渲染 html
我就是这样写消息的 常量回复电报 = { “chat_id”:米尔科, “照片”:row.image_url, “caption”:'Wo...
使用 telegram API(不是机器人 API)将我的联系人(其他用户)分享给其他用户,无需用户名
我有联系人并知道用户的 tg_id 和电话。如何使用 telegram API 向其他用户共享此联系人? 基本上,我只是想复制这个“共享此联系人”屏幕中的功能...
开发 Telegram API 机器人中的 Pyrogram 问题
我目前正在使用 Pyrogram 开发 Telegram API 机器人,但我遇到了一个正在努力解决的问题。目的是收集用户的电话号码并保存,