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
3
votes
1 answer

Telegram URL schema: which url to trigger the client to open the "share/send to" dialogue

I am working on an telegram bot, and looking for the exact URL schema to popup the "Share / Select Group / Send to" dialogue in the telegram client. I have seen this link in @pollbot, for which I took following screenshots. A bit more…
teleme.io
  • 815
  • 3
  • 10
  • 21
3
votes
1 answer

How to receive images from Telegram Bot

Can't receive images from my telegram bot, trying something like this: import telegram from telegram.ext import Updater from telegram.ext import MessageHandler from telegram.ext import Filters def photo_handler(bot, update): file =…
Yevgen
  • 51
  • 1
  • 1
  • 5
3
votes
3 answers

How do I upload an image to Telegram's sever

I'm writing a telegram bot (in Python) that sends images. I'm sending every images several times, and the documentation recommends to sent send a file_id of a file that is already stored in Telegram's sever. But I can't find any documentation about…
Ronen
  • 466
  • 4
  • 16
3
votes
1 answer

How to deploy a Telegram Bot with Nginx reverse proxy

I developed a Telegram bot with the python-telegram-bot library and now i want to deploy it in my server, so i setup a webhook(following the Official Wiki) but when i try to communicate with my bot i don't get any reply. This is the source of the…
beep
  • 1,057
  • 2
  • 11
  • 23
3
votes
1 answer

How can I make a unit test for python telegram bot?

I'm currently using python-telegram-bot for create telegram bot. But every change I made, I have to do feature test by my hands. How can I create a unit test for a telegram bot using a tool such as pytest or unittest? Is there a way to generate the…
3
votes
4 answers

Send a message to all users when the bot wake up

I've started tinkering with python recently and I'm on my way to create my very first telegram bot mainly for managing my Raspberry Pi and a few things connected to it. The bot is done but I would like to send a message to all the users that have…
GuillermoG
  • 33
  • 2
  • 4
3
votes
3 answers

Telegram api. Get all uploaded photos by media_group_id

I send to my telegram bot a few photos as group. How I can get the file_id all of my uploaded photos? I use webhooks, but response is not contain any data about all photos, just some data about last uploaded photo and media_group_id. How I can get…
3
votes
1 answer

Best practice for a back button implementation in telegram conversation bot

I'm trying to create a telegram conversation bot using python-telegram-bot package and I wondered what is the best practice for implementing a "back to main menu" button for each state in the conversation. For some reason, I feels like i'm doing it…
OriK
  • 293
  • 1
  • 3
  • 13
3
votes
2 answers

How to use ForceReply in python-telegram-bot wrapper

I've tried for quite a while, reading the python-telegram-bot wrapper APIpython-telegram-bot wrapper, telegram bot API, code snippets etc, but my lack of understanding(My programming knowledge is selective google copy-pastes) does not permit me to…
iG0tB0lts
  • 33
  • 1
  • 5
3
votes
2 answers

How to handle callbackquery in python telegram bot

In my code I'm facing an issue with callbackquery handler, when I hit /start command the "Next" button appears and when I hit on that button it gives me reply as "hi", till here the output is correct. Then when I hit another command "/help" then…
VISHAL LIMGIRE
  • 529
  • 1
  • 5
  • 21
3
votes
3 answers

Telegram Bot: Can we identify if message is from group admin?

I have added my bot to a group chat, now for few commands I need to give access only to the group admin, so is it possible to identify if the message sender is admin of the group? I am using python-telegram-bot library
Thiyaga B
  • 971
  • 1
  • 9
  • 26
3
votes
3 answers

ImportError: No module named 'telegram.vendor.ptb_urllib3

I want to start making telegram bots with Python. But I have a boring error: I was downloaded telegram-bot $ git clone https://github.com/python-telegram-bot/python-telegram-bot then $ cd python-telegram-bot/ $ Python setup.py install running…
3
votes
1 answer

Sqlite connection in python-telegram-bot

This is the simplified code for my telegram bot import telegram.bot, telegram, sqlite3 from telegram.ext import Updater,CommandHandler,MessageHandler,Filters class DatabaseManager(object): def __init__(self, db): self.conn =…
randomcoding
  • 89
  • 1
  • 3
  • 10
3
votes
3 answers

How to read messages from Telegram group with bot?

I would like to connect a simple telegram bot to read messages from a group, (where I'm not admin). I already added the bot to the group, but it doesn't work. Here is the code I have in Python: import telepot from pprint import pprint import…
Lord
  • 153
  • 1
  • 4
  • 15
3
votes
2 answers

Telegram bot: How to get chosen inline result

I'm sending InlineQueryResultArticle to clients and i'm wondering how to get chosen result and it's data (like result_id,...). here is the code to send results: token = 'Bot token' bot = telegram.Bot(token) updater = Updater(token) dispatcher =…
Ali Sherafat
  • 3,506
  • 2
  • 38
  • 51