telegram-bot

Is there a better way with NodeJs to get updates from a Telegram bot?

你说的曾经没有我的故事 提交于 2021-02-10 17:27:53
问题 I'm using simply like below: class Bot { constructor(token) { let _baseApiURL = `https://api.telegram.org`; //code here } getAPI(apiName) { return axios.get(`${this.getApiURL()}/${apiName}`); } getApiURL() { return `${this.getBaseApiUrl()}/bot${this.getToken()}`; } getUpdates(fn) { this.getAPI('getUpdates') .then(res => { this.storeUpdates(res.data); fn(res.data); setTimeout(() => { this.getUpdates(fn); }, 1000); }) .catch(err => { console.log('::: ERROR :::', err); }); } } const bot = new

How to send telegram mediaGroup with caption/text

痞子三分冷 提交于 2021-02-08 14:59:27
问题 I'm currently using python-telegram-bot and basically what I want to achieve with it is to send telegram messages like this: So the message consists of 2+ photos/videos with text message underneath. What I've already tried: sending message with send_message method, and including photo URLs, but it only shows 1 picture which is under the text sending media group using send_media_group, but this method has no caption parameter as send_photo. 回答1: You should use sendMediaGroup, where you can

How to get telegram bot user registered date via node.js?

旧时模样 提交于 2021-02-08 10:27:26
问题 How to get telegram bot user registered date in telegram via node.js? I couldn't find any method in telegram bot api ref! bot.on('message', (msg) => { console.log(msg); }); same as this bot: Robot Link 回答1: Unfortunately, there have no way to get this data from Telegram for now :( Quote from previous /START message (from the bot you mentioned): How it works To quote @Superuser27: Interpolation on known registration dates of certain IDs. The bot just has a large list of Account's IDs and their

How to get telegram bot user registered date via node.js?

你说的曾经没有我的故事 提交于 2021-02-08 10:25:17
问题 How to get telegram bot user registered date in telegram via node.js? I couldn't find any method in telegram bot api ref! bot.on('message', (msg) => { console.log(msg); }); same as this bot: Robot Link 回答1: Unfortunately, there have no way to get this data from Telegram for now :( Quote from previous /START message (from the bot you mentioned): How it works To quote @Superuser27: Interpolation on known registration dates of certain IDs. The bot just has a large list of Account's IDs and their

Automate setcommands

核能气质少年 提交于 2021-02-07 10:14:50
问题 Is it possible to automate the setcommands command? I want to register all my commands on startup of the application, so I don't have to do that manually (which kinda sucks during development). Is there a HTTP API or can I send a message to the Botfather from my bot? 回答1: There is not API method to set commands, you have to use the Botfather. 来源: https://stackoverflow.com/questions/37231451/automate-setcommands

Automate setcommands

六月ゝ 毕业季﹏ 提交于 2021-02-07 10:14:21
问题 Is it possible to automate the setcommands command? I want to register all my commands on startup of the application, so I don't have to do that manually (which kinda sucks during development). Is there a HTTP API or can I send a message to the Botfather from my bot? 回答1: There is not API method to set commands, you have to use the Botfather. 来源: https://stackoverflow.com/questions/37231451/automate-setcommands

How to send large file with Telegram Bot API?

丶灬走出姿态 提交于 2021-02-07 02:58:57
问题 Telegram bot has a file size limit for sending in 50MB. I need to send large files. Is there any way around this? I know about this project https://github.com/pwrtelegram/pwrtelegram but I couldn't make it work. Maybe someone has already solved such a problem? There is an option to implement the file upload via Telegram API and then send by file_id with bot. I write a bot in Java using the library https://github.com/rubenlagus/TelegramBots UPDATE For solve this problem i use telegram api,

How can I get Live Location in telegram bot via python?

倾然丶 夕夏残阳落幕 提交于 2021-02-06 13:56:07
问题 I'm using the python-telegram-bot library. I want to track a user's Live Location, but I don't know how to do it. I try to use Job Queue: def notification(bot, job): updates = bot.get_updates() print([u.message.location for u in updates]) # Add job to queue job = job_queue.run_repeating(notification, 10, 1, context=chat_id) chat_data['job'] = job But updates are void. I want to track location every 1 minutes. 回答1: Just to ellaborate on Seans answer: It can be done quite easily using the

What is InputMediaPhoto and how to send an array of such resources to Telegram API?

被刻印的时光 ゝ 提交于 2021-01-29 19:05:34
问题 I'm trying some Google Apps Script script for telegram bot API. var token = "BOT:TOKEN"; var telegramUrl = "https://api.telegram.org/bot" + token; var chat_id = "CHAT_ID"; var image1 = "https://telegram.org/img/t_logo.png"; var image2 = "https://www.gstatic.com/images/branding/product/2x/apps_script_48dp.png"; var data = { method: "post", payload: { "method": "sendMediaGroup", "chat_id": chat_id, "media": [ {"type": "photo", "media": image1}, {"type": "photo", "media": image2}, ] } }

How to use telegram webhook on google cloud functions?

主宰稳场 提交于 2021-01-29 07:50:36
问题 I have set up a telegram bot using webhooks in python on google cloud functions. Based on some sample code from the internet I got it to work as a simple echo-bot however the structure is very different to the bots I coded before using long polling: # main.py import os import telegram def webhook(request): bot = telegram.Bot(token=os.environ["TELEGRAM_TOKEN"]) if request.method == "POST": update = telegram.Update.de_json(request.get_json(force=True), bot) chat_id = update.message.chat.id #