python-telegram-bot

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

telegram bot api python run_daily method

天涯浪子 提交于 2021-01-29 16:41:41
问题 Hey i am trying to run a telegram bot on a daily base so i tried different things. updater = Updater(<botkey>, use_context=True) dp = updater.dispatcher dp.job_queue.run_daily(pollen, datetime.time(hour=20, minute=9), days=(0, 1, 2, 3, 4, 5, 6)) dp.add_error_handler(error) updater.start_polling() updater.idle() def pollen(update, context): bot.send_message(chat_id=chat_id, text='text') or updater = Updater(<botkey>, use_context=True) dp = updater.dispatcher dp.add_handler(CommandHandler(

Singing in TelegramClient telethon

混江龙づ霸主 提交于 2021-01-29 06:08:25
问题 After running the code, I try to enter a password (but I don’t have it) and can’t enter anything. I use VS Code Please enter your phone (or bot token): 79622222693 Please enter the code you received: 40589 Please enter your password: (CANT ENTER ANYTHING, AND I DON'T HAVE ANY PASS ON MY ACCOUNT) Tried different accounts. from telethon import TelegramClient, sync api_id = 973111111111145 api_hash = '05c6f86e67922222222222225ad7615a8' client = TelegramClient('sessi1onname', api_id, api_hash)

How to correctly use the iter_download functionality for multi connection downloads in Telethon

邮差的信 提交于 2021-01-21 10:55:08
问题 I've been trying to implement a multi threaded Telegram download client. For single downloads we can simply use the download_media functionality. But telethon offers iter_download function, as per documenation it is used for streaming which also includes pausing and resuming functionality. We can use this to download a single file with multiple connections. This is what I've scripted so far. No where to find any solid examples for multi connection download async def multi_downloader(file,

Python Telegram Bot how to wait for user answer to a question And Return It

强颜欢笑 提交于 2021-01-03 06:24:28
问题 Context: I am using PyTelegramBotAPi or Python Telegram Bot I have a code I am running when a user starts the conversation. When the user starts the conversation I need to send him the first picture and a question if He saw something in the picture, the function needs to wait for the user input and return whether he saw it or not. After that, I will need to keep sending the picture in a loop and wait for the answer and run a bisection algorithm on it. What I have tried so far: I tried to use

Python Telegram Bot how to wait for user answer to a question And Return It

我怕爱的太早我们不能终老 提交于 2021-01-03 06:24:12
问题 Context: I am using PyTelegramBotAPi or Python Telegram Bot I have a code I am running when a user starts the conversation. When the user starts the conversation I need to send him the first picture and a question if He saw something in the picture, the function needs to wait for the user input and return whether he saw it or not. After that, I will need to keep sending the picture in a loop and wait for the answer and run a bisection algorithm on it. What I have tried so far: I tried to use

Python Telegram Bot how to wait for user answer to a question And Return It

╄→гoц情女王★ 提交于 2021-01-03 06:23:23
问题 Context: I am using PyTelegramBotAPi or Python Telegram Bot I have a code I am running when a user starts the conversation. When the user starts the conversation I need to send him the first picture and a question if He saw something in the picture, the function needs to wait for the user input and return whether he saw it or not. After that, I will need to keep sending the picture in a loop and wait for the answer and run a bisection algorithm on it. What I have tried so far: I tried to use

How to migrate ConversationHandler module from Python-Telegram-Bot to Telethon

流过昼夜 提交于 2021-01-01 04:23:32
问题 Python-telegram-bot which is HTTP Telegram Bot API wrapper has telegram.ext.ConversationHandler module and its functionality is: "A handler to hold a conversation with a single user by managing four collections of other handlers." I'm migrating from this python-telegram-bot to Telethon MTProto API . And I have this ConversationHandler to manage conversation. How can I create any type of ConversationHandler in Telethon . Here is some little overview given by Telethon to migrate from python

How to migrate ConversationHandler module from Python-Telegram-Bot to Telethon

六月ゝ 毕业季﹏ 提交于 2021-01-01 04:23:31
问题 Python-telegram-bot which is HTTP Telegram Bot API wrapper has telegram.ext.ConversationHandler module and its functionality is: "A handler to hold a conversation with a single user by managing four collections of other handlers." I'm migrating from this python-telegram-bot to Telethon MTProto API . And I have this ConversationHandler to manage conversation. How can I create any type of ConversationHandler in Telethon . Here is some little overview given by Telethon to migrate from python