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
10
votes
2 answers

Telegram bot initiate conversation with a user

I am writing a Telegram bot, to simplify the issue let's say you can ask the bot questions in a channel and it replies to you in private. When the bot receives the command it takes the chat_id of the user from: update.message.from_user.id But when…
Uri Shalit
  • 2,198
  • 2
  • 19
  • 29
10
votes
3 answers

How can I remove inline keyboard after click?

My bot sends a pick with 2 inline callback buttons: like / dislike. After a user clicks on like or dislike button, I want this inline keyboard to disappear. This is how I make a dislike button dislike_button =types.InlineKeyboardButton…
Alex Nikitin
  • 841
  • 1
  • 10
  • 29
10
votes
3 answers

handle deleted message by user in telegram bot

Is there any way that can handle deleted message by user in one-to-one chat or groups that bot is member of it ? there is method for edited message update but not for deleted message .
alireza
  • 1,173
  • 4
  • 19
  • 40
10
votes
5 answers

Save user input after certain message telegram bot

I am building some telegram bot on python (using this framework pyTelegramBotAPI). And I ran into the problem with user input. I need save user input(it can be any text) after certain bot's message. For example: Bot: - Please describe your…
10
votes
2 answers

How to programmatically check if a cell phone number is registered in the Telegram?

I was wondering about what is the best way to know if a cell phone number has registered to the Telegram messenger or not? Thanks.
Adel
  • 3,542
  • 8
  • 30
  • 31
9
votes
4 answers

How to send message to telegram as ```code````

Sending the output of Prettytable to Telegram This question is a followup to an earlier question. The code which i have is this: import telegram from prettytable import PrettyTable def send_msg(text): token = "*******:**************" …
Slartibartfast
  • 1,058
  • 4
  • 26
  • 60
9
votes
2 answers

How to make Python-Telegram_bot send a message without getting a commad?

I'm Making a telegram bot using Python-Telegram-bot. I wanna make it send a message to one specific user (myself in this case) to select an option. after that, it should take that option as a command and work as usual. but after 30 min... it should…
M MO
  • 323
  • 4
  • 16
9
votes
2 answers

How can I receive file in python-telegram-bot?

I have a problem about file messages in python telegram bot. How can I receive file and read that file ? Or save it.
DR8002
  • 113
  • 1
  • 1
  • 7
9
votes
2 answers

Python Telegram Bot Markdown

I am working on a Telegram Bot in Python but I struggle to use markdown correctly and I can not find any proper resources about the telegram markdown implementation. It gets even more complicated because of two different markdown "versions"…
Schneyer
  • 1,197
  • 1
  • 9
  • 27
9
votes
2 answers

PythonBot - pass argument to command hanlder

I'm playing a little bit with Python Telegram Bot, I want to pass to my handler an argument obtained with previous computation, e.g: def my_handler(bot, update, param): print(param) def main(): res = some_function() …
Alessandro Gaballo
  • 708
  • 3
  • 13
  • 28
9
votes
4 answers

how to send photo by telegram bot using multipart/form-data

I have a telegram bot (developed in python) and i wanna to send/upload photo by it from images that are in my computer. so i should do it via multi part form data. but i don't know ho to do it. also i didn't find useful source for this on Internet…
mmsamiei
  • 165
  • 1
  • 2
  • 10
9
votes
2 answers

Multiple callback query handlers?

Is it possible with the python-telegram-bot wrapper to use more than one callback query handler? I would like to have multiple unique handlers but as far as I can tell, there can only be one. This means I'd have to base which inline keyboards I show…
George knife
  • 103
  • 1
  • 1
  • 6
8
votes
1 answer

How to create unit test for a Python Telegram Bot

I've built this Telegram Bot in Python, with python-telegram-bot. It's not so complex, but I want to do some regression tests to check if everything works fine after a new feature or a change, and more generally to test specific features to find…
8
votes
1 answer

How forward message to other contact with telethon

How do I forward a message to another chat as soon as I receive it from a contact? I created this example just to test routing, but it doesn't work. #!/usr/local/bin/python3 from telethon import TelegramClient, events api_id = 9999900 api_hash =…
8
votes
2 answers

Send messages to telegram group without user input

I'm trying to build a bot which automatically sends a message whenever there is an update in the latest news using python. Following is what I did. companies = { "name_1": { "rss": "name_1 rss link", "link": "name_1 link" …
Joe
  • 291
  • 1
  • 3
  • 18
1
2
3
96 97