Relative Content

Tag Archive for pythonpython-telegram-bot

How to change the url of button after it is sent in python telegram bot?

I have a bot which will send approximately 30 different messages with different InlineKeyboardButtons; each one of these buttons will point to a different URL. As each of the URLs is generated by a relatively time consuming process (that I an unable to speed up), and generally only one of the 30 buttons will be clicked, I would like to call the function to generate the URL only if the button is actually clicked AND have the URL open on the client device.

telegram python API to send multiple pictures in one post

async def send_photos(bot_token, chat_id, photo_paths, caption, t): bot = Bot(token=bot_token) try: async with bot: media_list = [InputMediaPhoto(open(path, ‘rb’)) for path in photo_paths] await bot.send_media_group(chat_id=chat_id, media=media_list, caption=caption) except: print(f’Failed to send_photos – {t}’) async def post_to_telegram(t): try: bot_token = ‘token’ chat_id = ‘chat_id’ image_paths = [‘tmp/img1′,’tmp/img2’] caption = ‘test sending multiple images in one post’ await […]