php-telegram-bot

How to download full size photo using Telegram Bot API uploaded from user

你说的曾经没有我的故事 提交于 2020-08-27 21:27:03
问题 I'm working on a telegram bot and I need to download photo, audio, video sent by user to the bot. Using the only path returned by the get file method I only get a thumbnail. In fact the only result of the get file method contains a really tiny value for the file size. I can't figure out where the problem is. The photos are normally sent by message as photo (not as file). 回答1: first you should download the photo with this api to your bot https://api.telegram.org/bot<token>/getfile?file_id={the

Sending animated GIFs with sendPhoto (Telegram bot)

*爱你&永不变心* 提交于 2020-08-24 06:51:42
问题 I'm trying to send an animated GIF with sendPhoto (Telegram's Bot API) with this request: https://api.telegram.org/bot<token>/sendPhoto?chat_id=<chat_id>&photo=http://i.giphy.com/13IC4LVeP5NGNi.gif That method works, as in, I get ok:true back, but the image in the chat window is a still snapshot of the moving GIF. How can I get the animated GIF to show? Is there another method I should use? 回答1: You should use the sendAnimation method for sending a GIF or H.264/MPEG-4 AVC video without sound

How can I mention Telegram users without a username?

Deadly 提交于 2020-02-03 04:40:34
问题 I want mention users even those which d o not have a username . If a user has set up a username I return Hi @username as an answer but if a user does not have one I can't do that. I tried using the unique User ID e.g. @5642166 but that did not work. How can I achieve that? 回答1: According to official documentation it is possible to mention user by its numerical id with markup: Markdown style To use this mode, pass Markdown in the parse_mode field when using sendMessage . Use the following

php telegram answercallbackquery sendmessage

安稳与你 提交于 2020-01-17 06:39:10
问题 I'm trying to develop a Telegram Bot in PHP, but i failed to make my bot answer the user when he press an inline button. Can someone help me sending a message (sendMessage method) after calling the answerCallback method? Here's my last trial code: if ($call_back_query != null) { $response = $call_back_query; $botUrl = "https://api.telegram.org/bot" . BOT_TOKEN . "/answerCallbackQuery"; $postFields = array('callback_query_id' => $call_back_id, 'text' => $response); $ch = curl_init(); curl

generate inline keyboard telegram bot from the database

大憨熊 提交于 2019-12-25 17:37:53
问题 hi I have some product cat in my database I want to generate inline keyboard from the theme but I want to like this we have cat1-ca2-ca3-ca4-ca5 I want to like this cat1 cat2 cat3 cat4 cat5 I need the loop for this result thanks 回答1: When you get the values that you want to show in the keyboard, you need to store these in array. This example was did in Javascript, you must found the equivalent in php code. If you only have 5 products you don't need a loop, just: ... { 'reply_markup': JSON

How to use telegram api package in CakePHP 3?

余生长醉 提交于 2019-12-25 05:04:53
问题 I tried to use PHP telegram bot in my CakePHP 3 website, but encountered many problems. done I ran "composer require longman/telegram-bot" and copied package to "plugins" folder. and then "bin/cake plugin load longman/telegram-bot". questions 1. Where I must put the package and why? vendor or plugins 2. How to call package methods in URL? I added "index" method to "telegram-bot/src/Telegram.php" and tried this snippet code in my "Template/Users/index.ctp". echo $this->Html->link('telegram', [

how to promote users to supergroup using telegram bot api(PHP)?

一笑奈何 提交于 2019-12-25 00:37:58
问题 I'm using this code to add some of my users to a supergroup but it doesn't work is there something wrong with it? function makereq($method,$datas=[]) { $url = "https://api.telegram.org/bot".API_KEY."/".$method; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($datas)); $res = curl_exec($ch); if(curl_error($ch)){ var_dump(curl_error($ch)); }else{ return json_decode($res); } } makereq(

Message not receiving automatically for Telegram CHATBOT funciton using PHP

纵饮孤独 提交于 2019-12-23 04:33:31
问题 In order to integrate Telegram Chatbot using PHP, I have already followed below steps. Server with SSL certificate Webhook with working condition URL : https://api.telegram.org/bot/setWebhook?url=https://mywebsite.com/path/to/filename.php Created ChatBot and have a valid Token After that, I have made simple PHP file using following line of code. <?php define('BOT_TOKEN', 'CHANGE-ME'); define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/'); // This is to read incoming message and