- Home
- Skills
- Testing & Debugging
- Telegram Bot Scaffolder
Works with the AI tools you already use
Telegram Bot Scaffolder
Scaffold and debug production-ready Python Telegram bots with persistent state and async handlers.
$5.99
Telegram Bot Scaffolder
Example session with this skill installed
I need a bot scaffold that asks a user for their name and favorite programming language, then saves it. It needs to work after I restart the script. Use python-telegram-bot.
- Read your context and instructions
- Compiled the telegram bot scaffolder
I have scaffolded a persistent Telegram bot using python-telegram-bot v20. It uses a ConversationHandler to manage the flow and aiosqlite to ensure data persists across restarts.
Telegram Bot Scaffold
# bot.py
import logging
from telegram.ext import ApplicationBuilder, CommandHandler, ConversationHandler, MessageHandler, filters
from db import init_db
from handlers import start, get_name, get_language, cancel, error_handler
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
NAME, LANGUAGE = range(2)
def main():
# Initialize DB before starting
init_db()
app = ApplicationBuilder().token("YOUR_TOKEN_HERE").build()
conv_handler = ConversationHandler(
entry_points=[CommandHandler("start", start)],
states={
NAME: [MessageHandler(filters.TEXT & ~filters.COMMAND, get_name)],
LANGUAGE: [MessageHandler(filters.TEXT & ~filters.COMMAND, get_language)],
},
fallbacks=[CommandHandler("cancel", cancel)],
persistent=False # Local state is handled by our DB wrapper for reliability
)
app.add_handler(conv_handler)
app.add_error_handler(error_handler)
print("Bot is polling...")
app.run_polling()
if __name__ == "__main__":
main()
# db.py
import sqlite3
def init_db():
with sqlite3.connect("bot_data.db") as conn:
conn.execute("""
CREATE TABLE IF NOT EXISTS users (
user_id INTEGER PRIMARY KEY,
name TEXT,
language TEXT
)
""")
conn.commit()
def save_user_data(user_id, name=None, language=None):
with sqlite3.connect("bot_data.db") as conn:
if name:
conn.execute("INSERT OR REPLACE INTO users (user_id, name) VALUES (?, ?)", (user_id, name))
if language:
conn.execute("UPDATE users SET language = ? WHERE user_id = ?", (language, user_id))
conn.commit()
Next steps
- Replace
"YOUR_TOKEN_HERE"with your actual token from BotFather. - Run
pip install python-telegram-botto install dependencies. - Ensure
bot_data.dbis included in your.gitignorebut persisted in your production volume.
Connects securely to your tools. The creator never sees your data.
What you get
About this skill
The problem
Building a Telegram bot that works in development but fails in production is common. Most bots suffer from silent failures, lost conversation states after restarts, or duplicate message handling due to improper polling configurations.
What it does
- Generates production-ready Python scaffolds using
python-telegram-botoraiogramwith async best practices. - Implements persistent state management using SQLite to ensure conversation data survives process restarts.
- Configures centralized error handling and logging to surface production exceptions that usually fail silently.
- Diagnoses specific deployment issues like webhook certificate mismatches, concurrent polling conflicts, and Docker volume persistence errors.
Frameworks & tools
Python 3.10+, python-telegram-bot (v20+), aiogram, SQLite, aiosqlite, and Docker.
Why this beats prompting it yourself
Generic LLM prompts often produce single-file scripts that use in-memory dictionaries for state, which wipe your data on every deploy. This skill enforces a structured architecture with ConversationHandler logic and persistent storage, preventing the "dead-end" bugs typical of AI-generated bot code.
Use cases
- Scaffolding a multi-step registration bot with persistent user data.
- Migrating a prototype from local polling to production-grade webhooks.
- Debugging a bot that responds twice or fails to track user progress in a flow.
- Adding async API calls to handlers without blocking the main event loop.
Known limitations
Only supports Telegram Bot API. Does not support Discord, Slack, or WhatsApp. Assumes single-instance deployments (SQLite-based) unless external databases are requested.
How to install
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 3
Ask your agent to use it
Restart the agent if it was already running. It picks the skill up automatically - no config needed.
Skills folder by agent
Click the path to copy it. Create the folder if it does not exist yet.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
2 installs
Downloaded by developers to date
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean 15 days ago
- Passed all security checks, Safe to install