PackAPunch b4u Bot

Test this app for free
26
from utils import telegram

from utils import print_setup_instructions
import os
import logging
import traceback
from flask import Flask, render_template, request, jsonify, session
from telegram import Update, ParseMode
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext
from abilities import apply_sqlite_migrations
from models import db, StoreStatus, Order
from datetime import datetime
import uuid

TELEGRAM_API_TOKEN = os.getenv('TELEGRAM_API_TOKEN')
OWNER_ID = int(os.getenv('OWNER_ID', 0))  # Default to 0 if not set

logger = logging.getLogger(__name__)
logging.basicConfig(
    level=logging.DEBUG,  # Changed to DEBUG for more detailed logging
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
    handlers=[
        logging.StreamHandler(),  # Console output
        logging.FileHandler('telegram_bot.log')  # Log to file for persistent debugging
Get full code

Created: | Last Updated:

Telegram bot for PackAPunch channel to handle orders for mystery boxes, display store hours, manage active status, process orders, support cancellations, offer coupon codes, enable direct messaging, and include a referral program.

PackAPunch b4u Bot Template Guide

This template creates a Telegram bot for managing a store's operations, including order processing, store hours, and status management.

Getting Started

  • Click "Start with this Template" to begin
  • Set up your environment secrets in the Environment Secrets tab:
  • TELEGRAM_API_TOKEN: Your Telegram bot API token
  • OWNER_ID: Your Telegram user ID

Setting Up Your Telegram Bot

  1. Create a new bot with BotFather:
  2. Open Telegram and search for @BotFather
  3. Send /newbot command
  4. Follow prompts to name your bot
  5. Copy the API token provided by BotFather

  6. Get your Telegram User ID:

  7. Message @userinfobot on Telegram
  8. Copy the ID number it provides

  9. Add these values to Environment Secrets:

  10. Add TELEGRAM_API_TOKEN with your bot token
  11. Add OWNER_ID with your Telegram user ID

Testing the Bot

  • Click the "Test" button
  • The bot will start and provide a link to chat with it
  • Click the link to start interacting with your bot

Using the Bot

Available commands: * /start - Initiates the bot * /help - Shows all available commands * /hours - Displays store hours and owner status * /active - Toggles store status (owner only)

The bot also includes a checkout system accessible via web interface at the provided server URL + /checkout.

Store Management Features

  • Toggle active/inactive status using /active
  • Process orders through the checkout system
  • Monitor store hours and status
  • Handle customer interactions via Telegram

The template includes both a Telegram bot interface and a web-based checkout system, allowing for comprehensive store management and order processing.



Template Benefits

  1. Automated Order Management
  2. Streamlines the order processing workflow through a Telegram bot interface
  3. Reduces manual intervention and human error in order handling
  4. Provides real-time order status updates to both customers and owners

  5. Multi-Channel Sales Integration

  6. Combines web-based checkout with Telegram bot functionality
  7. Supports multiple payment methods (Apple Pay, Zelle, Cryptocurrencies)
  8. Creates a seamless experience across different platforms

  9. Business Availability Control

  10. Allows owner to easily toggle store active status via Telegram commands
  11. Provides transparent store hours and availability information to customers
  12. Maintains clear communication about service availability 24/7

  13. Enhanced Customer Service

  14. Offers immediate automated responses to common customer queries
  15. Provides clear command structure for customer interactions
  16. Enables direct communication channel between customers and business owner

  17. Secure Transaction Processing

  18. Implements secure database storage for order information
  19. Maintains detailed transaction records with unique order IDs
  20. Supports multiple payment options with built-in verification systems

Technologies

Flask Templates from Lazy AI – Boost Web App Development with Bootstrap, HTML, and Free Python Flask Flask Templates from Lazy AI – Boost Web App Development with Bootstrap, HTML, and Free Python Flask
Streamline JavaScript Workflows with Lazy AI: Automate Development, Debugging, API Integration and More  Streamline JavaScript Workflows with Lazy AI: Automate Development, Debugging, API Integration and More
Streamline Telegram Automation with Lazy AI: Automate Bots, Messages, Workflows and More Streamline Telegram Automation with Lazy AI: Automate Bots, Messages, Workflows and More
Python App Templates for Scraping, Machine Learning, Data Science and More Python App Templates for Scraping, Machine Learning, Data Science and More
Optimize SQL Workflows with Lazy AI: Automate Queries, Reports, Database Management and More Optimize SQL Workflows with Lazy AI: Automate Queries, Reports, Database Management and More

Similar templates

We found some blogs you might like...