python-telegram-bot

how to specify if the message was from group or private in python telegram bot

how to specify if the message was from group or private in python telegram bot Question: Here is my code: # 1st method if chat.type == ‘supergroup’: # Check if the bot’s name was mentioned in the message # if bot_name in message_text: # Generate a response to the question response_text = generate_response(message_text) update.message.reply_text(response_text) elif …

Total answers: 2

Telegram bot – How to handle conversations?

Telegram bot – How to handle conversations? Question: I am trying to learn to make a telegram bot but I am not sure how to achieve continuous conversations. All I know is how to respond to the individual messages, for example like this – If a user enters wrong command, for example /jnaddaad def unknown_response(update: …

Total answers: 1

How to check user is admin or not in python-telegram-bot?

How to check user is admin or not in python-telegram-bot? Question: Im using python-telegram-bot I want to check if the user in the group is an admin or not, if the user is an admin he can use the commands and if the user is not an admin, he will receive a message saying that …

Total answers: 1

Some questions about using python-telegram-bot

Some questions about using python-telegram-bot Question: Some questions about using python-telegram-bot I’m using python-telegram-bot to create a telegram bot. I want to forward a graphic message (similar to the one below) to the robot, and the robot removes the image and returns the text. I didn’t find an example in the official documentation. I hope …

Total answers: 1

Automatically edit last Telegram bot message after expiration period

Automatically edit last Telegram bot message after expiration period Question: I’m trying to figure out how I can set an "expiration timer" on a message sent by a Telegram bot, containing a few buttons. Long story short, there’s a function which selects a random picture from a folder, then sends it to a group, and …

Total answers: 2

Python-telegram-bot bypass flood and 429 error using Scrapy

Python-telegram-bot bypass flood and 429 error using Scrapy Question: I follow the price drops on the target site. If there is a price decrease in accordance with the rules I have set, it is recorded in the notificate table. From there, a telegram notification is sent through the code I created in the pipelines.py file. …

Total answers: 1

Python Telegram bot daily_routine callback not triggered from JobQueue

Python Telegram bot daily_routine callback not triggered from JobQueue Question: I have the following bot: class Bot: def __init__(self, handlers: list[BaseHandler], daily_routines): self.application = Application.builder().token(BOT_TOKEN).build() for handler in handlers: self.application.add_handler(handler) self.job_queue = JobQueue() self.job_queue.set_application(self.application) for routine in daily_routines: self.job_queue.run_daily(routine, time=datetime.time(hour=15, minute=49, tzinfo=pytz.timezone(‘Asia/Jerusalem’))) def __call__(self, *args, **kwargs): self.application.run_polling() if __name__ == "__main__": _handlers = [ … …

Total answers: 1

AutoResponder Telegram Script

AutoResponder Telegram Script Question: I want to use that script (https://github.com/Gunthersuper/telegram-autoresponder/blob/main/bot.py) but only in a specific period of time and dont reply my messages when is out of time. Deleted api_id and api_hash from telethon import TelegramClient, events import time print ("Hora actual " + time.strftime("%H:%M:%S")) print ("Hora actual " + time.strftime("%H")) horario = ["08", …

Total answers: 1

How to call method without go to ConversationHandler in python-telegram-bot

How to call method without go to ConversationHandler in python-telegram-bot Question: How can I fix this problem? I get information from the user, for example, email address, but if that address is wrong, I show an error message to the user, and I want the user to redirect to get the input email address again …

Total answers: 2

python-telegram-bot error "TypeError: __dict__ slot disallowed: we already got one"

python-telegram-bot error "TypeError: __dict__ slot disallowed: we already got one" Question: import logging from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, Update from telegram.ext import ( Updater, CommandHandler, MessageHandler, Filters, ConversationHandler, CallbackContext, ) ## MANY FUNCTIONS HERE…. def main() -> None: """Run the bot.""" # Create the Updater and pass it your bot’s token. updater = Updater(myToken) # …

Total answers: 3