telegram-bot

How to get channel updates with Telegram robot

孤人 提交于 2020-05-29 21:10:52
问题 I have searched over Telegram API and Bot API docs for days and it seems there is no direct way for a robot to get notified when there is a new update in a channel say a News channel, Sports channel, etc. The only thing I came up with was: A hook returns updates for channel only when the robot is an administrator member: { "update_id": 673009340, "message": { "message_id": 160, "from": { "id": 104911111, "is_bot": false, "first_name": "Jason", "username": "jason", "language_code": "en-US" },

Telegram bot API is the chat_id unique for each user contacting the bot?

回眸只為那壹抹淺笑 提交于 2020-05-29 07:43:52
问题 We are using python API for telegram bots and need to be able to identify the user. Is the chat_id unique for each user connecting the bot? Can we trust the chat_id to be consistent? e.g same chat_id will tell us that this is the same user, and each user connecting with the bot will have one chat_id that is consistent between sessions? Thanks 回答1: Is the chat_id unique for each user connecting the bot? Yes chat_id will always be unique for each user connecting to your bot. If the same user

Connect telegram bot with google apps script

泪湿孤枕 提交于 2020-05-26 09:58:54
问题 I have setup a bot on telegram bot and connected it with google spreadsheets via apps script by following this tutorial. Here is the code: var token = ""; // FILL IN YOUR OWN TOKEN var telegramUrl = "https://api.telegram.org/bot" + token; var webAppUrl = ""; // FILL IN YOUR GOOGLE WEB APP ADDRESS var ssId = ""; // FILL IN THE ID OF YOUR SPREADSHEET function getMe() { var url = telegramUrl + "/getMe"; var response = UrlFetchApp.fetch(url); Logger.log(response.getContentText()); } function

Telegram bot - OAuth authorization

隐身守侯 提交于 2020-05-24 21:27:45
问题 I want to implement OAuth authorization by Twitch API on my bot, and when I was looking for a better solution, I found this @GitHubBot. In this bot redirect URL starting for integrations.telegram.org/github, and I wonder how to implement auth like this. If you please, can you tell best practice to implement OAuth in telegram bots? What the better case: Authorization Code or Implicit Grant? Thank you in advance! 回答1: I had the same idea of authorizing access to 3rd party services via Telegram

Telegram bot - OAuth authorization

不羁岁月 提交于 2020-05-24 21:27:10
问题 I want to implement OAuth authorization by Twitch API on my bot, and when I was looking for a better solution, I found this @GitHubBot. In this bot redirect URL starting for integrations.telegram.org/github, and I wonder how to implement auth like this. If you please, can you tell best practice to implement OAuth in telegram bots? What the better case: Authorization Code or Implicit Grant? Thank you in advance! 回答1: I had the same idea of authorizing access to 3rd party services via Telegram

How to deactivate inline mode in your Bot?

天大地大妈咪最大 提交于 2020-05-16 20:34:21
问题 How to deactivate inline mode in your Bot? When you talk to BotFather by /help he doesn't give any instructions. Thanks 回答1: Type /setinline , choose bot to disable inline mode, that type /empty . This will disable inline mode in your bot. 回答2: Use /setinline and then /setnoinline command to disable inline mode. 来源: https://stackoverflow.com/questions/37099589/how-to-deactivate-inline-mode-in-your-bot

Telegram Bot download image file

∥☆過路亽.° 提交于 2020-05-13 14:45:31
问题 I'm trying to download file (image ) using my bot, but when I download the image ( which is done successfully ) after using getFile, the image I received is very small 1.7 kb while it's bigger than that on my mobile phone 回答1: the getFile Method present a JSON object (the 1.7 KB response) that contain the data for accessing your image file. also note that telegram create an array of image for any image. the first element of this array contain the small thumbnail of your original image and the

Retrieve all chat ids using Telegram bot

☆樱花仙子☆ 提交于 2020-05-12 11:40:33
问题 the main question is how do I get the chat ids for all the conversations ever held with the bot? Imagine that during the execution of the bot there is a conversation with the user A. Now I stop the bot process and start it again. How do I get the chat id of that past chat with the user A? I understand you get the chat id when the user sends you a message, and you use that id to reply, but what if user A no longer sends messages to the bot during the current execution? how to get the past

How can i get file_path of telegram bot

◇◆丶佛笑我妖孽 提交于 2020-05-12 07:05:09
问题 I have a telegram bot webhook message like { "update_id":236420475, "message":{ "message_id":26577, "from":{ "id":xxxxxxxx, "first_name":"DB", "last_name":"Ks", "username":"xxxxxxxx" }, "chat":{ "id":193044649, "first_name":"DB", "last_name":"Ks", "username":"xxxxxxxx", "type":"private" }, "date":1493266832, "voice":{ "duration":2, "mime_type":"audio/ogg", "file_id":"AwADBQADBAADQKMIVC978KStO6ZhAg", "file_size":7532 } } } From the telegram bot API documentation there is a file_path specified

Sending message in telegram bot with images

落花浮王杯 提交于 2020-05-11 05:19:49
问题 I have telegram-bot code on php, and reply messages sending by replyWithMessage method. All command here: $this->replyWithMessage(['text' => $item['title']. "\n\n" . $url]); How can i add some preview image before text? 回答1: You can use /sendphoto and set the caption which appears under an image. https://core.telegram.org/bots/api#sendphoto 回答2: You can't send a text message that contains both image and text. However If your text contains URL, Telegram displays a preview of the web page by