Bot
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 10/100
Research direction
The issue contains a standalone Python bot snippet but names no repository file, test, entry point, or requested change. First inspect the repository context around issue #3155 and clarify the intended outcome and scope before coding; completion criteria are not provided.
Written by the indexing model from the issue text.
Description
import logging
import json
import os
from aiogram import Bot, Dispatcher, executor, types
from aiogram.types import ReplyKeyboardMarkup, KeyboardButton
logging.basicConfig(level=logging.INFO)
Telegram tokenni Replit Secrets (🔒) dan oling
BOT_TOKEN = os.getenv("8680300677:AAEzbGu8DHv4B9n9cI9xgkmA9ueA5EvS_GE")
bot = Bot(token=8680300677:AAEzbGu8DHv4B9n9cI9xgkmA9ueA5EvS_GE)
dp = Dispatcher(bot)
Ma'lumotlar va fayllar saqlanishi
DATA_FILE = "users.json"
MEDIA_FOLDER = "files"
if not os.path.exists(MEDIA_FOLDER):
os.makedirs(MEDIA_FOLDER)
Foydalanuvchilarni yuklash / saqlash
def load_users():
if not os.path.exists(DATA_FILE):
return {}
with open(DATA_FILE, "r", encoding="utf-8") as f:
return json.load(f)
def save_users(data):
with open(DATA_FILE, "w", encoding="utf-8") as f:
json.dump(data, f, ensure_ascii=False, indent=2)
users = load_users()
Telefon yuborish tugmasi
phone_kb = ReplyKeyboardMarkup(resize_keyboard=True)
phone_kb.add(KeyboardButton("📞 Telefon raqamni yuborish", request_contact=True))
/start komandasi
@dp.message_handler(commands=["start"])
async def start(msg: types.Message):
await msg.answer(
"Assalomu alaykum!\nBot orqali ro‘yxatdan o‘tasiz.\nTelefon raqamingizni yuboring.",
reply_markup=phone_kb
)
Telefon raqam qabul qilish
@dp.message_handler(content_types=types.ContentType.CONTACT)
async def get_phone(msg: types.Message):
user_id = str(msg.from_user.id)
users[user_id] = {
"name": msg.from_user.full_name,
"phone": msg.contact.phone_number,
"passport": "",
"driver_license": "",
"car_passport": "",
"files": []
}
save_users(users)
await msg.answer("✅ Telefon qabul qilindi.\nEndi pasport ma’lumotini kiriting:", reply_markup=types.ReplyKeyboardRemove())
Pasport
@dp.message_handler(lambda m: str(m.from_user.id) in users and users[str(m.from_user.id)]["passport"] == "")
async def get_passport(msg: types.Message):
user_id = str(msg.from_user.id)
users[user_id]["passport"] = msg.text.strip()
save_users(users)
await msg.answer("✅ Pasport qabul qilindi.\nEndi haydovchilik guvohnomangizni kiriting:")
Haydovchilik guvohnomasi
@dp.message_handler(lambda m: str(m.from_user.id) in users and users[str(m.from_user.id)]["driver_license"] == "")
async def get_driver_license(msg: types.Message):
user_id = str(msg.from_user.id)
users[user_id]["driver_license"] = msg.text.strip()
save_users(users)
await msg.answer("✅ Haydovchilik guvohnomasi qabul qilindi.\nEndi mashina texnik pasportini kiriting:")
Mashina texnik pasporti
@dp.message_handler(lambda m: str(m.from_user.id) in users and users[str(m.from_user.id)]["car_passport"] == "")
async def get_car_passport(msg: types.Message):
user_id = str(msg.from_user.id)
users[user_id]["car_passport"] = msg.text.strip()
save_users(users)
await msg.answer("✅ Texnik pasport qabul qilindi.\nEndi hujjatlarni rasm/fayl sifatida yuborishingiz mumkin:")
Fayl / rasm qabul qilish
@dp.message_handler(content_types=[types.ContentType.DOCUMENT, types.ContentType.PHOTO])
async def handle_files(msg: types.Message):
user_id = str(msg.from_user.id)
if user_id not in users:
await msg.answer("Iltimos, /start buyrug‘i orqali ro‘yxatdan o‘ting.")
return
file_id = None
if msg.content_type == "document":
file_id = msg.document.file_id
file_name = msg.document.file_name
await msg.document.download(os.path.join(MEDIA_FOLDER, file_name))
elif msg.content_type == "photo":
file_id = msg.photo[-1].file_id
file_name = f"{file_id}.jpg"
await msg.photo[-1].download(os.path.join(MEDIA_FOLDER, file_name))
users[user_id]["files"].append(file_name)
save_users(users)
await msg.answer(f"✅ Fayl qabul qilindi va saqlandi: {file_name}")
Avto-javob
@dp.message_handler()
async def auto_reply(msg: types.Message):
await msg.answer("🤖 Avto-javob:\nIltimos, /start buyrug‘ini bosing va ro‘yxatdan o‘ting.")
Bot ishga tushadi
if name == "main":
executor.start_polling(dp, skip_updates=True)
- Dominant language
- Python
- Stars
- 35.4k
- Forks
- 12.9k
- Avg merge
- 2h 37m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from geekcomputers/Python
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
geekcomputers/Python#3205 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
geekcomputers/Python#3188 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
geekcomputers/Python#3060 · 1 comment ·
-
[BUG] shapchat Open
Difficulty 5/5 Over a week Newbie friendliness 10/100
geekcomputers/Python#3214 · 5 comments ·
-
Test of an Issue Open
Difficulty 5/5 Over a week Newbie friendliness 10/100
geekcomputers/Python#3209 · 5 comments ·
All issues in geekcomputers/Python
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
learningequality/ricecooker#747 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
run-llama/llama_index#23199 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
KhronosGroup/glTF-Blender-IO#2769 ·