Telegram News / Beta / Unofficial Desktop Versions / Web / TG Bots / Subreddit / DMG by RTP [MacOS]
250 subscribers
1.78K photos
2.77K videos
1.14K files
20.1K links
Telegram Channel by @roadtopetabyte http://pixly.me/rtp - Announcements: @rtptme
Download Telegram
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…
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.
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.
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 • 4More
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 • 4More
Forwarded from Telegram News
This media is not supported in your browser
VIEW IN TELEGRAM
Super Channels. Channel owners can make their feed look more like a group – allowing admins to post as their own profiles or other channels.

August Features
1 • 2 • 3 • 4More
Forwarded from Telegram Tips
This media is not supported in your browser
VIEW IN TELEGRAM
Weather Widget in Stories. You can share the weather in your stories – with an animated widget that automatically converts temperature and shows moon phases at night.

More widgets can be found in the 'Stickers' section of the story editor – to add music, links, locations and more.
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
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
1234Mais
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
1234Mais
Forwarded from Telegram Brasil
This media is not supported in your browser
VIEW IN TELEGRAM
Supercanais. Os proprietários de canais podem fazer com que o feed do canal se pareça mais com um grupo, permitindo que os administradores postem como os próprios perfis ou outros canais.

Recursos de agosto
1234Mais
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.
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 • 4Má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 • 4Más
Forwarded from Noticias de Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
Supercanales. Los propietarios de canales pueden hacer que su feed se vea más parecido a un grupo, permitiendo a los administradores publicar a nombre de sus propios perfiles u otros canales.

Funciones de agosto
1 • 2 • 3 • 4Más