telegram-bot

How to identify from which telegram bot request came?

How to identify from which telegram bot request came? Question: I want to create two telegram bots on one adress https://example.com this is working with webhooks, but i can’t identify from which bot request came. This is what i recieve from bot 1: { "update_id": 610779399, "message": { "message_id": 58, "from": { "id": 299470913, "is_bot": …

Total answers: 1

How to send photos with multipart/form-data in media group with python requests?

How to send photos with multipart/form-data in media group with python requests? Question: json = {"chat_id":chat_id, "media":[{"type" : "photo", "media" : "attach://photo1.jpg"}, {"type" : "photo", "media" : "attach://photo2.jpg"}]} files = {"photo1.jpg" : open(r"../photo1.jpg", ‘rb’), "photo2.jpg" : open(r"../photo2.jpg", ‘rb’)} temp = r.post("https://api.telegram.org/bot<TOKEN>/sendMediaGroup", json=json, files=files) print(temp.json()) I keep getting this response: {‘ok’: False, ‘error_code’: 400, ‘description’: ‘Bad …

Total answers: 1

Why telegram bot doesn't conflict with nginx?

Why telegram bot doesn't conflict with nginx? Question: I wrote a simple telegram bot and it works great without conflicting with my firewall. But my question is this, in the firewall I have ports 80 and 443 allowed for my site, but when I write a TCP socket in Python that should work through port …

Total answers: 2

How to make an asynchronous time counter/trigger?

How to make an asynchronous time counter/trigger? Question: I am writing a telegram bot using aiogram. The bot will be used by a lot of people and the bot has an order module. The task of this module is to create orders that must be closed on time. For example, the bot requests the date …

Total answers: 1

How to call method without go to ConversationHandler in python-telegram-bot

How to call method without go to ConversationHandler in python-telegram-bot Question: How can I fix this problem? I get information from the user, for example, email address, but if that address is wrong, I show an error message to the user, and I want the user to redirect to get the input email address again …

Total answers: 2

Telegram bot to send auto message every n hours with python-telegram-bot

Telegram bot to send auto message every n hours with python-telegram-bot Question: I am quite new in building bots so I created a very simple Telegram bot and it works great but can’t figure out how to make the bot send messages every n minutes or n hours when /start_auto command is initiated. I made …

Total answers: 4

How to make bold text in python query?

How to make bold text in python query? Question: I’m doing a GET request using the Telegram Bot API. I use the following query telegram_msg = requests.get(f’https://api.telegram.org/<botname>:<botAPI>/sendPhoto?chat_id=<chatID>&parseMode=MarkdownV2&photo={link}&caption=*bold*{title}*nn{res}’) So I want the title to be bold. What am I doing wrong? Can someone help me please? Asked By: Laura || Source Answers: The issue is caused …

Total answers: 1

Text + image not working with telegram bot

Text + image not working with telegram bot Question: Having troubles with sending image with text. Instead of actual image, I’m just getting the path to it. I wonder if someone knows what is the problem in my code. Instead of the path I want an actual image import telebot from telebot import types bot …

Total answers: 2

How to make user hyperlink in python telegram bot?

How to make user hyperlink in python telegram bot? Question: Stack overflow! I’m using telebot module for my telegram bot (from telebot import types). I want to send messages to telegram users. In this messages I want to paste a link to another telegram users. My code is: linked_user = ‘[username](tg://user?id=999999999)’ bot.send_message( admin_chat_id, f'{linked_user}’, parse_mode=’MarkdownV2′, …

Total answers: 2

Is there a way to change avatar in telegram bot using python?

Is there a way to change avatar in telegram bot using python? Question: I was trying to find some documentation, but i`ve failed. I would be grateful if you send me doc or example how to do it. Asked By: qruim || Source Answers: In order to change your profile photo you should use MTPROTOAPI. …

Total answers: 2