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

how to add start button in telegram bot with python-telegran-bot sdk?

I want to write a simple bot for telegram with python-telegram-bot SDK. I want to show a "START" keyboard button instead of typing "/start" command to work with my bot. How to do this with python-telegram-bot?
snoba
  • 53
  • 1
  • 3
5
votes
3 answers

Using Telegram- InlineKeyboardMarkup, do I can provide feedback to the user when a button is press?

def start(bot, update): keyboard = [[InlineKeyboardButton("Apples", callback_data='1')], [InlineKeyboardButton("Oranges", callback_data='2')], [InlineKeyboardButton("Beans", callback_data='3')], …
ed tru
  • 101
  • 1
  • 2
  • 7
5
votes
1 answer

How do I get the group ID and chat ID with telegram inline bot?

Does any of you guys knows how @like telegram bot works? When I call it in a group using inline, then select to make a new post, it forwards me to the bot chat, and when I finish, it forwards me back to the group I was. So it must have the group ID…
Pablo
  • 510
  • 8
  • 22
5
votes
4 answers

How to receive file_id through python-telegram-bot?

I'm making a Telegram bot using python-telegram-bot, and I need some way to receive voice messages. For that, I need to download them, and to do that, I have to get their file_ids. However, the MessageHandler handles... well, messages, and Handler…
Danya02
  • 1,006
  • 1
  • 9
  • 24
5
votes
1 answer

Telegram API: doesn't send message to user until receive first message from that user

I use Telegram API to send a message to a user with my bot. When the user sends me a message, that operation works but when I want to send a message to an user that haven't sent me any message to me before, then an error occurs (I have his user…
Bojbaj
  • 472
  • 1
  • 6
  • 15
4
votes
1 answer

How to resolve TypeError: __init__() missing 1 required positional argument: 'update_queue'?

I want to create a Telegram bot that checks for a new post on a website (currently every 15s for testing purposes). If so, it should send a message with content from the post into the Telegram channel. For this I already have the following "code…
4
votes
2 answers

AttributeError: 'Updater' object has no attribute 'dispatcher'

When I run this code: from telegram.ext import * import keys print('Starting a bot....') def start_commmand(update, context): update.message.reply_text('Hello! Welcome To Store!') if __name__ == '__main__': updater =…
4
votes
0 answers

Is it possible in python-telegram-bot to get update when somebody puts a "reaction" (like/dislike/other emojis) on message?

The following code using python-telegram-bot (for the bot added as admin in some group) captures all kind of messages - posting messages, replies, edits. But when somebody puts like (or other emojis) on existing message, a handler function is not…
augur
  • 354
  • 2
  • 7
4
votes
2 answers

Question about async handling in python-telegram-bot

I have a question that has been bothering me for a long time. I would greatly appreciate your help! Let's imagine a situation like this: You entered a function by a command. In this particular function, there is a loop that takes a long time to…
Junyi Lou
  • 41
  • 1
  • 3
4
votes
1 answer

How to send a document with Telegram bot?

I followed a tutorial in youtube on how to create a Telegram Bot and for now it can only send messages but I want to send even files like documents or audio, video, photos etc... For now im just trying to send a file but I'm pretty confused and I…
Jugert Mucoimaj
  • 339
  • 1
  • 2
  • 14
4
votes
2 answers

python telegram bot disallow nested conversations

I am writing conversations with python-telegram-bot and need a way to disable nested conversations. That is, if a user is in a conversation, then an entry command for another conversation should not activate another handler. It seems that this is…
Artem Trunov
  • 1,340
  • 9
  • 16
4
votes
3 answers

Send text message via python to the Telegram Bot

I have been trying since the morning but earlier there were errors, so i had the direction but now there is no error and even not a warning too.. How code looks like : import requests def send_msg(text): token = "TOKEN" chat_id = "CHATID" url_req =…
Rushikant Pawar
  • 428
  • 1
  • 5
  • 14
4
votes
1 answer

How to add URL to InlineKeyboardButton for Telegram Bot

I would like to make the button that will open URL (external hyperlink) in browser from Telegram chat. Currently, I developed only clickable action buttons. update.message.reply_text( 'Subscribe to us on Facebook and Telegram:', …
wowkin2
  • 5,895
  • 5
  • 23
  • 66
4
votes
2 answers

How can I login multiple accounts using telethon...?

I am trying to build a python script which requires login with multiple telegram accounts. I don't want to run a separate script for each account.I am using TELETHON. I know that there is something like create_new_connection in telethon, but I don't…
4
votes
1 answer

How to migrate ConversationHandler module from Python-Telegram-Bot to Telethon

Python-telegram-bot which is HTTP Telegram Bot API wrapper has telegram.ext.ConversationHandler module and its functionality is: "A handler to hold a conversation with a single user by managing four collections of other handlers." I'm migrating from…