Questions tagged [python-telegram-bot]

This is a Python library that wraps around the Telegram Bot API. Note that this is not a general tag for "Telegram bots written with Python", but only for question about this particular library.

This is a library that wraps around the bot HTTP API. It is compatible with only (please check the PyPi/GitHub page for detailed info).

Telegram Bot API

The Telegram Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.

1454 questions
6
votes
1 answer

how to read/receive telegram channel messages in my telegram bot?

i'm trying to create a bot which can read/receive all messages in a specific channel and send them to me . my problem here is that i can't find a way to access those messages in my bot important thing is: i'm not admin or creator of that channel i…
maryam
  • 61
  • 1
  • 2
6
votes
1 answer

python-telegram-bot.I already PORT 8443 but Error while bootstrap set webhook: Bad webhook: webhook can be set up only on ports 80, 88, 443 or 8443

I just find the post without any reply on stackoverflow when i create this post... TelegramBot. "Webhook can be set up only on ports 80, 88, 443 or 8443" error on heroku webserver my testing code is here: from configparser import ConfigParser import…
codinLover
  • 73
  • 2
  • 7
6
votes
2 answers

Need download voice message from Telegram on Python

I started developing a pet project related to telegram bot. One of the points was the question, how to download a voice message from the bot? Task: Need to download a audiofile from telegram bot and save in project…
6
votes
1 answer

Error with urllib3 and the python-telegram-bot API

when i try to run my script (my telegram bot) the following appears in terminal: /usr/local/lib/python3.7/dist-packages/python_telegram_bot-12.4.2- py3.7.egg/telegram/utils/request.py:47: UserWarning: python-telegram-bot is using upstream urllib3.…
user12229635
6
votes
2 answers

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

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,…
Espoir Murhabazi
  • 5,973
  • 5
  • 42
  • 73
6
votes
1 answer

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

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…
6
votes
2 answers

Change telegram bot name on the fly

I have a telegram bot that messages on a group. I want the telegram bot to change its “name” from time to time - just like a user can. Is this possible? This means that when I see a message from the bot it can say “ABCbot”, but later it can say…
6
votes
1 answer

Telegram API throwing PeerFloodError: Too many requests

I am not using bot API. I am using Telegram API to send messages. Messages are being sent easily but the problem occurs after 19 users. On the 20th user, I receive PeerFloodError. Even after, searching a lot, I didn't find any specific limits and…
6
votes
1 answer

Newline in telegram inline keyboard for python

my button text is too long to fit in one line of my inline keyboard for the python telegram bot. "\n" wont do. Code info: /key is the only command it understands. It reads the API token from the file token.txt in the code directory. Here is my…
JulianWgs
  • 961
  • 1
  • 14
  • 25
6
votes
2 answers

Read the messages of the public channels from Telegram

I need to read the messages of some public channels in the application, as for example it happens https://tlgrm.ru/channels/tech As I understood, the bot for this business will not work. You need to use client api, but everywhere that with the…
wpbloger
  • 169
  • 1
  • 1
  • 10
6
votes
2 answers

resizing Telegram inline keyboard

Telegram's inline keyboard is a great feature with lots of different use cases. Inline buttons are added as a list of items like this: inline_keyboard = [[InlineKeyboardButton(text="button", callback_data="button"), …
S. Ali Mirferdos
  • 192
  • 1
  • 2
  • 12
6
votes
1 answer

How to set up python-telegram-bot webhook on Heroku?

I'm using the python-telegram-bot wrapper, and I've been trying to host a simple echo telegram bot on Heroku adapting a pre-existing example that was meant for the Google App Engine as well as the webhook guide on the wiki, but to no avail. I do not…
Shinlos
  • 137
  • 1
  • 10
6
votes
5 answers

Telegram bot API: get message id to forward it

So, I need my bot to forward a message of a chat. But in order to do so, I need to get the id of the message I want to forward (it's an old message). How can I get the id of that message so I can send it? This is the code I'm…
José María
  • 2,835
  • 5
  • 27
  • 42
6
votes
2 answers

Handle multiple questions for Telegram bot in python

I'm programming a telegram bot in Python using the Telegram bot API. I'm facing the problem of managing questions that need an answer of the user. The problem arises when the program is waiting for an answer of one user and another user request…
Dargor
  • 623
  • 1
  • 4
  • 12
5
votes
1 answer

How to get topic id for telegram group chat?

Recently Telegram added support for Topics in Groups in Bot API version 6.3 and this support added into python-telegram-bot version 13.15 (please find changelog https://docs.python-telegram-bot.org/en/stable/changelog.html) It's not clear how to get…
yurnov
  • 53
  • 1
  • 4