No respond from chatbot
tldr, i am not receiving any respond from the chatbot after entering email, providing phone number and choosing subscribe to newsletter. Below is the code import loggingimport refrom telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, Update, KeyboardButtonfrom telegram.ext import Application, CommandHandler, MessageHandler, filters, ContextTypes# Enable logginglogging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)logger = logging.getLogger(__name__)# Define valid e-stamp codesVALID_CODES = {"CODE1", "CODE2", "CODE3", "CODE4"}REDEEMED_CODES = set() # Track redeemed codes# Define ReplyKeyboard buttonssubscribe_buttons = [ [KeyboardButton("Subscribe to Newsletter")], [KeyboardButton("Do Not Subscribe")]]main_menu_buttons = [ [KeyboardButton("Newsletter")], [KeyboardButton("Redeem E-Stamps")], [KeyboardButton("Notice")]]EMAIL_REGEX = r'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$'PHONE_REGEX = r'^\+?\d{10,15}$'def update_main_menu_buttons(replace=False): """Updates the main menu buttons based on the current state.""" global main_menu_buttons if replace and "Redeem E-Stamps" in [btn[0].text for btn in main_menu_buttons]: main_menu_buttons = [[KeyboardButton("Reveal Reward") if btn[0].text == "Redeem E-Stamps" else btn[0]] for btn in main_menu_buttons] # Ensure "Notice" is always the last button main_menu_buttons = [btn for btn in main_menu_buttons if btn[0].text != "Notice"] main_menu_buttons.append([KeyboardButton("Notice")])# Function to handle /start commandasync def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: context.user_data['stage'] = 'email' reply_markup = ReplyKeyboardRemove() await update.message.reply_text( "Welcome! Please enter your email address:", reply_markup=reply_markup )# Function to handle email input and validationasync def handle_email(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: stage = context.user_data.get('stage', 'email') email = update.message.text.strip() if stage == 'email': if re.match(EMAIL_REGEX, email): context.user_data['email'] = email context.user_data['stage'] = 'phone' await update.message.reply_text( "Email verified! Now, please enter your phone number:", reply_markup=ReplyKeyboardMarkup( [[KeyboardButton("Enter Phone Number", request_contact=True)]], resize_keyboard=True ) ) else: await update.message.reply_text( "Invalid email address. Please enter a valid email:" )# Function to handle phone number input and validationasync def handle_phone(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: stage = context.user_data.get('stage', 'phone') phone_number = update.message.contact.phone_number if update.message.contact else update.message.text.strip() if stage == 'phone': if re.match(PHONE_REGEX, phone_number): context.user_data['phone_number'] = phone_number context.user_data['stage'] = 'subscription' reply_markup = ReplyKeyboardMarkup(subscribe_buttons, one_time_keyboard=True, resize_keyboard=True) await update.message.reply_text( "Phone number verified! Would you like to subscribe to our newsletter?", reply_markup=reply_markup ) else: await update.message.reply_text( "Invalid phone number. Please enter a valid phone number:", reply_markup=ReplyKeyboardMarkup( [[KeyboardButton("Enter Phone Number", request_contact=True)]], resize_keyboard=True ) )# Function to handle subscription choicesasync def handle_subscription(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: user_choice = update.message.text stage = context.user_data.get('stage', 'subscription') global main_menu_buttons if stage == 'subscription': if user_choice == "Subscribe to Newsletter": main_menu_buttons = [btn for btn in main_menu_buttons if btn[0].text != "Newsletter"] await update.message.reply_text( "Thank you for subscribing! What would you like to do next?", reply_markup=ReplyKeyboardMarkup(main_menu_buttons, resize_keyboard=True) ) elif user_choice == "Do Not Subscribe": await update.message.reply_text( "No problem! What would you…
tldr, i am not receiving any respond from the chatbot after entering email, providing phone number and choosing subscribe to newsletter. Below is the code import loggingimport refrom telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, Update, KeyboardButtonfrom telegram.ext import Application, CommandHandler, MessageHandler, filters, ContextTypes# Enable logginglogging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)logger = logging.getLogger(__name__)# Define valid e-stamp codesVALID_CODES = {"CODE1", "CODE2", "CODE3", "CODE4"}REDEEMED_CODES = set() # Track redeemed codes# Define ReplyKeyboard buttonssubscribe_buttons = [ [KeyboardButton("Subscribe to Newsletter")], [KeyboardButton("Do Not Subscribe")]]main_menu_buttons = [ [KeyboardButton("Newsletter")], [KeyboardButton("Redeem E-Stamps")], [KeyboardButton("Notice")]]EMAIL_REGEX = r'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$'PHONE_REGEX = r'^\+?\d{10,15}$'def update_main_menu_buttons(replace=False): """Updates the main menu buttons based on the current state.""" global main_menu_buttons if replace and "Redeem E-Stamps" in [btn[0].text for btn in main_menu_buttons]: main_menu_buttons = [[KeyboardButton("Reveal Reward") if btn[0].text == "Redeem E-Stamps" else btn[0]] for btn in main_menu_buttons] # Ensure "Notice" is always the last button main_menu_buttons = [btn for btn in main_menu_buttons if btn[0].text != "Notice"] main_menu_buttons.append([KeyboardButton("Notice")])# Function to handle /start commandasync def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: context.user_data['stage'] = 'email' reply_markup = ReplyKeyboardRemove() await update.message.reply_text( "Welcome! Please enter your email address:", reply_markup=reply_markup )# Function to handle email input and validationasync def handle_email(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: stage = context.user_data.get('stage', 'email') email = update.message.text.strip() if stage == 'email': if re.match(EMAIL_REGEX, email): context.user_data['email'] = email context.user_data['stage'] = 'phone' await update.message.reply_text( "Email verified! Now, please enter your phone number:", reply_markup=ReplyKeyboardMarkup( [[KeyboardButton("Enter Phone Number", request_contact=True)]], resize_keyboard=True ) ) else: await update.message.reply_text( "Invalid email address. Please enter a valid email:" )# Function to handle phone number input and validationasync def handle_phone(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: stage = context.user_data.get('stage', 'phone') phone_number = update.message.contact.phone_number if update.message.contact else update.message.text.strip() if stage == 'phone': if re.match(PHONE_REGEX, phone_number): context.user_data['phone_number'] = phone_number context.user_data['stage'] = 'subscription' reply_markup = ReplyKeyboardMarkup(subscribe_buttons, one_time_keyboard=True, resize_keyboard=True) await update.message.reply_text( "Phone number verified! Would you like to subscribe to our newsletter?", reply_markup=reply_markup ) else: await update.message.reply_text( "Invalid phone number. Please enter a valid phone number:", reply_markup=ReplyKeyboardMarkup( [[KeyboardButton("Enter Phone Number", request_contact=True)]], resize_keyboard=True ) )# Function to handle subscription choicesasync def handle_subscription(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: user_choice = update.message.text stage = context.user_data.get('stage', 'subscription') global main_menu_buttons if stage == 'subscription': if user_choice == "Subscribe to Newsletter": main_menu_buttons = [btn for btn in main_menu_buttons if btn[0].text != "Newsletter"] await update.message.reply_text( "Thank you for subscribing! What would you like to do next?", reply_markup=ReplyKeyboardMarkup(main_menu_buttons, resize_keyboard=True) ) elif user_choice == "Do Not Subscribe": await update.message.reply_text( "No problem! What would you…
1571 groups and channels related to child abuse banned on August, 15.
Total this month: 26793
Report child abuse using the in-app 'Report' button or to stopCA@telegram.org.
Total this month: 26793
Report child abuse using the in-app 'Report' button or to stopCA@telegram.org.
152 terrorist bots and channels banned on August, 15.
Total this month: 2375
Report terrorist content using the in-app 'Report' button or to abuse@telegram.org.
Total this month: 2375
Report terrorist content using the in-app 'Report' button or to abuse@telegram.org.
Forwarded from Telegram News
This media is not supported in your browser
VIEW IN TELEGRAM
Star Reactions. Users can directly support their favorite channels and content creators by sending them Telegram Stars with a new ⭐️ Star reaction.
August Features
1 • 2 • 3 • 4 • More
August Features
1 • 2 • 3 • 4 • More
Please open Telegram to view this post
VIEW IN TELEGRAM
Forwarded from Telegram News
This media is not supported in your browser
VIEW IN TELEGRAM
Star Subscriptions. Content creators can make special invite links that allow users to join a channel in exchange for a monthly payment in Telegram Stars.
August Features
1 • 2 • 3 • 4 • More
August Features
1 • 2 • 3 • 4 • More
Forwarded from Telegram News
This media is not supported in your browser
VIEW IN TELEGRAM
Paid Media for Bots. Bots are able to send paid media – to support their services and automate businesses.
August Features
1 • 2 • 3 • 4 • More
August Features
1 • 2 • 3 • 4 • More
Forwarded from Telegram News
This media is not supported in your browser
VIEW IN TELEGRAM
Forwarded from Telegram News
August Features
1 • 2 • 3 • 4 • More
Please open Telegram to view this post
VIEW IN TELEGRAM
Telegram
Super Channels, Star Reactions and Subscriptions
Today is Telegram's 11th anniversary. Meet Star Reactions and Star Subscriptions that let users support content creators, paid media for bots and Business accounts, and a new mode for Telegram Channels that lets admins post as their other channels or personal…
Forwarded from Telegram Tips
This media is not supported in your browser
VIEW IN TELEGRAM
python-telegram-bot
I would love to provide code but due to the commercial nature of the project I'd have to cut a lot of it out and I think the issue can be solved without it. Context: As stated in the title I'm using python-telegram-bot and trying to host it on pythonanywhere.My issues are two following errors:
telegram.error.NetworkError: httpx.RemoteProtocolError: Server disconnected without sending a response.
telegram.error.NetworkError: httpx.ProxyError: 503 Service UnavailableThese errors only occur on the cloud server, locally everything is fine. Does anyone know what is the issue here? I can provide few chunks of my code if that helps!
Submitted August 16, 2024 at 02:51PM by Nifrilus
on r/TelegramBots via https://www.reddit.com/r/TelegramBots/comments/1etnyx2/pythontelegrambot/Backup by @tmebackupA @rtptme project - Other backups: http://pixly.link/tme
I would love to provide code but due to the commercial nature of the project I'd have to cut a lot of it out and I think the issue can be solved without it. Context: As stated in the title I'm using python-telegram-bot and trying to host it on pythonanywhere.My issues are two following errors:
telegram.error.NetworkError: httpx.RemoteProtocolError: Server disconnected without sending a response.
telegram.error.NetworkError: httpx.ProxyError: 503 Service UnavailableThese errors only occur on the cloud server, locally everything is fine. Does anyone know what is the issue here? I can provide few chunks of my code if that helps!
Submitted August 16, 2024 at 02:51PM by Nifrilus
on r/TelegramBots via https://www.reddit.com/r/TelegramBots/comments/1etnyx2/pythontelegrambot/Backup by @tmebackupA @rtptme project - Other backups: http://pixly.link/tme
Forwarded from Telegram Brasil
This media is not supported in your browser
VIEW IN TELEGRAM
Reações com Estrelas. Os usuários podem apoiar diretamente seus canais e criadores de conteúdo favoritos enviando Estrelas do Telegram com a nova reação de Estrela ⭐️ .
Recursos de agosto
1 • 2 • 3 • 4 • Mais
Recursos de agosto
1 • 2 • 3 • 4 • Mais
Please open Telegram to view this post
VIEW IN TELEGRAM
Forwarded from Telegram Brasil
This media is not supported in your browser
VIEW IN TELEGRAM
Assinaturas com Estrelas. Os criadores de conteúdo podem criar links de convite especiais que permitem que os usuários entrem em um canal em troca de um pagamento mensal em Estrelas do Telegram.
Recursos de agosto
1 • 2 • 3 • 4 • Mais
Recursos de agosto
1 • 2 • 3 • 4 • Mais
Forwarded from Telegram Brasil
This media is not supported in your browser
VIEW IN TELEGRAM
Mídias Pagas para Bots. Os bots agora podem enviar mídias pagas para apoiar seus serviços e automatizar negócios.
Recursos de agosto
1 • 2 • 3 • 4 • Mais
Recursos de agosto
1 • 2 • 3 • 4 • Mais
Forwarded from Telegram Brasil
This media is not supported in your browser
VIEW IN TELEGRAM
Forwarded from Telegram Brasil
Recursos de agosto
1 • 2 • 3 • 4 • Mais
Please open Telegram to view this post
VIEW IN TELEGRAM
Telegram
Supercanais, Estrelas como Reações e Assinaturas
Hoje é o 11º aniversário do Telegram. Desde agosto de 2013, pioneiramos centenas de funcionalidades e crescemos para quase um bilhão de usuários com zero orçamento de marketing — tudo graças ao apoio que recebemos de vocês, nossos queridos usuários e criadores…
Forwarded from Tips de Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
Widget de clima en historias. Puedes compartir el clima en tus historias, con un widget animado que convierte la temperatura automáticamente y muestra las fases lunares en la noche.
Puedes encontrar más widgets en la sección “Stickers” del editor de historias, para añadir música, enlaces, ubicaciones y más.
Puedes encontrar más widgets en la sección “Stickers” del editor de historias, para añadir música, enlaces, ubicaciones y más.
Forwarded from Noticias de Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
Reacciones con estrellas. Los usuarios pueden apoyar directamente a sus canales y creadores de contenido favoritos enviándoles estrellas de Telegram con una nueva ⭐ reacción de estrella.
Funciones de agosto
1 • 2 • 3 • 4 • Más
Funciones de agosto
1 • 2 • 3 • 4 • Más
Please open Telegram to view this post
VIEW IN TELEGRAM
Forwarded from Noticias de Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
Suscripciones con estrellas. Los creadores de contenido pueden crear enlaces de invitación especiales que permiten a los usuarios unirse a un canal a cambio de un pago mensual con estrellas de Telegram.
Funciones de agosto
1 • 2 • 3 • 4 • Más
Funciones de agosto
1 • 2 • 3 • 4 • Más
Forwarded from Noticias de Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
Multimedia de pago para bots. Los bots pueden enviar multimedia de pago para apoyar sus servicios y automatizar negocios.
Funciones de agosto
1 • 2 • 3 • 4 • Más
Funciones de agosto
1 • 2 • 3 • 4 • Más
Forwarded from Noticias de Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
Forwarded from Noticias de Telegram
Funciones de agosto
1 • 2 • 3 • 4 • Más
Please open Telegram to view this post
VIEW IN TELEGRAM
Telegram
Supercanales, reacciones con estrellas y suscripciones
Hoy es el 11° aniversario de Telegram. Desde agosto de 2013, hemos sido pioneros en cientos de funciones y crecido hasta llegar a cerca de mil millones de usuarios sin presupuesto de marketing, todo gracias al apoyo que hemos de ustedes, nuestros queridos…