Ketab

Open Beginner friendly
#70 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
90/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

The issue contains a hardcoded bot token in the code. Look for the TOKEN variable in the provided script and replace it with a secure method, such as reading from an environment variable. Check the repository for existing configuration patterns or a .env.example file. After the change, verify the bot still starts and responds to the /start command.

Written by the indexing model from the issue text.

Description

from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import (
ApplicationBuilder,
CommandHandler,
CallbackQueryHandler,
ContextTypes
)

TOKEN = "8739806734:AAGhzCLG45DWV6jMHAkbN4Ku-jOVBM0vKHQ"

استارت

async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
keyboard = [
[InlineKeyboardButton("📚 خدمات کتاب", callback_data="books")]
]

await update.message.reply_text(
    "به فروشگاه کتاب خوش آمدید:",
    reply_markup=InlineKeyboardMarkup(keyboard)
)

دکمه‌ها

async def button(update: Update, context: ContextTypes.DEFAULT_TYPE):
query = update.callback_query
await query.answer()

if query.data == "books":
    keyboard = [
        [InlineKeyboardButton("📘 کتاب روانشناسی", callback_data="book1")],
        [InlineKeyboardButton("📗 کتاب اطلس خدا", callback_data="book2")],
        [InlineKeyboardButton("📕 روانشناسی جلد ۳۱", callback_data="book3")]
    ]

    await query.edit_message_text(
        "کتاب مورد نظر را انتخاب کنید:",
        reply_markup=InlineKeyboardMarkup(keyboard)
    )

elif query.data == "book1":
    await query.edit_message_text(
        "📘 کتاب روانشناسی\n💰 قیمت: 800,000 تومان"
    )

elif query.data == "book2":
    await query.edit_message_text(
        "📗 کتاب از من خدا\n💰 قیمت: 900,000 تومان"
    )

elif query.data == "book3":
    await query.edit_message_text(
        "📕 کتاب روانشناسی جلد ۳۱\n💰 قیمت: 900,000 تومان"
    )

app = ApplicationBuilder().token(TOKEN).build()

app.add_handler(CommandHandler("start", start))
app.add_handler(CallbackQueryHandler(button))

app.run_polling()

Dominant language
Python
Stars
225
Forks
672
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AbirHasan2005/PyroFilesStoreBot

All issues in AbirHasan2005/PyroFilesStoreBot

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.