telegram-bot

Is there a way to get user coordinates from telegram bot using Dialogflow?

人走茶凉 提交于 2019-12-25 01:26:02
问题 Currently im working on a telegram bot with Dialogflow. I want to get information about the user like current coordinates and user name but im not able to get them in the JSON coming from telegram. Is there a way to do such a thing without using any related google assistant events? 回答1: You can check the structure of updates received by bot on the documentation Telegram Bot API update.message.from contains the User object. update.message.location contains the Location object. Be aware that

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(

Telegram bot sending message to itself but not in a public group

守給你的承諾、 提交于 2019-12-24 23:37:55
问题 I made a telegram bot with @botfather and promoted the bot as admin of the public group. Whenever I try to send a message from the python code, it always sends the message to itself, I mean in the private chat and not in the public group. Snapshot of the code written: bot_token = 'XXXXXXXXXXXXXXXXXXX' bot_chatID = '395014927' bot_message = "Testing" send_text = 'https://api.telegram.org/bot' + bot_token + '/sendMessage?chat_id=' + bot_chatID + '&text=' + bot_message response = requests.get

How to handle multiple requests in PHP?

亡梦爱人 提交于 2019-12-24 15:21:00
问题 I'm using the below code to make a simple telegram bot in php: $message = json_decode(file_get_contents('php://input'), true); // if it's not a valid JSON return if(is_null($message)) return; $endpoint = "https://api.telegram.org/bot<token>/"; // make sure if text and chat_id is set into the payload if(!isset($message["message"]["text"]) || !isset($message["message"]["chat"]["id"])) return; // remove special characters, needed for the interpreter apparently $text = $message["message"]["text"]

How to use setWebhook in Telegram with self certificates on Windows 7 and PHP?

此生再无相见时 提交于 2019-12-24 13:42:44
问题 I'm quite a newbye in Telegram and I'm trying moving my first steps with it. I've found a good tutorial here https://www.youtube.com/watch?v=hJBYojK7DO4: I've configured my Apache 2.4 with PHP and SSL and all works fine, also the samples in the tutorial. Troubles are using the setWebhook method .... when I try to put in my browser https://api.telegram.org/<my_bot_code>/setWebHook?url=https://localhost/Telegram/MyYouTubeTutorialBot/YouTubeTutorialBot.php the response is {"ok":false,"error_code

How to ensure that chat_id exists?

戏子无情 提交于 2019-12-24 08:59:14
问题 I wrote a piece of code which sends messages to a Telegram bot. In order to do so, I use the chat_id of the last conversation retrieved via the getUpdates method. id = requests.get(f"https://api.telegram.org/bot{token}/getUpdates").json()['result'][-1]['message']['chat']['id'] My understanding is that the a conversation exists if someone started one with the bot via /start . How can I initiate, from my code, a conversation to make sure a chat_id is available? (= that there is a conversion I

How do I know if a telegram user joined my channel?

守給你的承諾、 提交于 2019-12-24 07:53:48
问题 I am writing a C# desktop app.in this app I write a telegram Id of a user and it says that user is member of the channel or not. my bot is admin of the channel. I use telegram.bot v9 nugget and searched about this issue all day. I tried using GetChatMembersCountAsync() in v13 and a lot of other methods but didn't work. static private Api bot = new Api("Token"); long id; string channel="@ChannelName"; public Main() { InitializeComponent(); } private void button1_Click(object sender, EventArgs

set webhook for telegram bot and what is self sign certificate

巧了我就是萌 提交于 2019-12-24 07:48:28
问题 I set webHook for my telegram bot by this : > https://api.telegram.org/bot<Token>/setWebhook?url=https://mywebapp.com/index.jsp I don't set any certificate for this. But when I (or a telegram user) send message to this bot, https://mywebapp.com/index.jsp does not get any request!! when I send any kind of message to robot, no request gotten by https://mywebapp.com/index.jsp. What should I do? Is certificate necessary for telegram bot webhook? 回答1: You need a valid SSL certificate for webhooks

bot.sendphoto does not work asp.net

旧巷老猫 提交于 2019-12-24 07:40:16
问题 I have a problem when I use the following code: try { var url = "https://www.telegadmin.com/image/tinakish/qavasi.jpg"; var uri = new Uri(url); using (WebClient webClient = new WebClient()) { using (Stream stream = webClient.OpenRead(uri)) { //bot.SendTextMessageAsync(update.Message.Chat.Id, "تا اینجا اوکیه", replyMarkup: mainMenu); bot.SendPhotoAsync(update.Message.Chat.Id, new FileToSend("test.jpg", stream), caption: "این تصویر از سرور برای شما ارسال شده است", replyMarkup: mainMenu); return

Upload a file with POST request golang

梦想与她 提交于 2019-12-24 05:48:05
问题 I'm new to golang and I'm trying to write a function that uploads a file with a post request to telegram for a bot I'm writing. I've tried with this code but the error I'm getting from telegram is Bad Request: there is no photo in the request . I've searched on the net for how to do that, but none of what I found helped me through the problem. func SendPostRequest (url string, filename string) []byte { file, err := os.Open(filename) if err != nil { log.Fatal(err) } defer file.Close() response