python-telegram-bot

Getting/sending some information from Telegram at bot startup, after Application build() but before run_polling()?

Getting/sending some information from Telegram at bot startup, after Application build() but before run_polling()? Question: I’m a bit confused about this because Im new to python-telegram,-bot, and most examples online dont reflect the v20 changes for Updater and asyncio. The relevant snippet of code is: def main() -> None: persistence_object = PicklePersistence(filepath=persistent_data_file_path) application = ( …

Total answers: 1

Runging own Telgram bot based on PTB 13x and local Telegram bot API behind nginx

Runging own Telgram bot based on PTB 13x and local Telegram bot API behind nginx Question: Try to use local Telegram bot API to take benefits of larger files for my bot serving and helping users in supergroup with files as described here Build stack with Telegram Bot API, nginx as reverse proxy and my …

Total answers: 1

MessageHandler not able to catch commands

MessageHandler not able to catch commands Question: we would like to monitor users who send commands to the bot, but when the bot is started, the messagehandler is able to catch messages and report that a private chat is started, but it seems that it can’t catch any of the three pre-defined commands(which are working …

Total answers: 1

Python Telegram bot doesn't start running at all

Python Telegram bot doesn't start running at all Question: I am a Python beginner trying to create a Telegram scheduler bot using the python-telegram-bot library and some code snippets I found online. However, when I try to run the code, the bot doesn’t seem to start running at all. I have double-checked that I am …

Total answers: 1

Subscribe mechanism in telegram bot

Subscribe mechanism in telegram bot Question: I’m trying to build a bot that basically has two threads. One thread is doing something, generating data and another thread is managing telegram bot. User can subscribe on telegram to receive updates from the first thread. This first thread calls the second one when it generates data and …

Total answers: 1

I need a forward function code which forward the original message (pyrogram)

I need a forward function code which forward the original message (pyrogram) Question: @bot.on_message(filters.chat(INPUT_CHANNELS) & filters.text) def forward_message(client, message: Message): text = message.text client.send_message(chat_id=DESTINATION_CHANNEL, text=text) I got this code here, but it just forwards text from the message although there is an image. I need it to forward the original message, keeping all the content …

Total answers: 1

How to get voice file in python-telegram-bot

How to get voice file in python-telegram-bot Question: Im using python-telegram-bot im trying to get voice file from user in chat, but im getting error error: RuntimeWarning: coroutine ‘ExtBot.get_file’ was never awaited return await self.callback(update, context) RuntimeWarning: Enable tracemalloc to get the object allocation traceback and this is my codes: async def get_voice(update: Update, context: …

Total answers: 1

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

AttributeError: 'Updater' object has no attribute 'dispatcher' Question: 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 = Updater(keys.token, True) dp = updater.dispatcher # Commands dp.add.handler(CommandHandler(‘start’, start_commmand)) # Run bot updater.start_polling(1.0) updater.idle() I get this error: Traceback (most …

Total answers: 2