Files
quiz_test/tools/demo.py
Andrey K. Choi b0346e4bd7
Some checks reported errors
continuous-integration/drone/push Build encountered an error
cleaning root
2025-09-11 08:18:31 +09:00

85 lines
3.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""
Демонстрационный запуск Quiz Bot
Показывает структуру и возможности бота без реального токена
"""
import asyncio
import sys
import os
from pathlib import Path
# Добавляем путь к проекту
project_root = Path(__file__).parent
sys.path.append(str(project_root))
from config.config import config
from src.database.database import DatabaseManager
async def demo():
"""Демонстрация возможностей бота"""
print("🤖 Quiz Bot - Демонстрация")
print("=" * 50)
if not config.bot_token or config.bot_token == "your_bot_token_here":
print("⚠️ Токен бота не настроен!")
print("📝 Чтобы запустить бота:")
print(" 1. Создайте бота у @BotFather в Telegram")
print(" 2. Скопируйте токен в .env файл")
print(" 3. Запустите: python src/bot.py")
print()
# Проверяем базу данных
print("📊 Проверка базы данных...")
db = DatabaseManager(config.database_path)
# Получаем доступные тесты
tests = await db.get_tests_by_category()
print(f"✅ Найдено тестов: {len(tests)}")
for test in tests:
print(f" 📚 {test['name']} (Уровень {test['level']})")
print(f" {test['description']}")
# Показываем несколько вопросов из теста
questions = await db.get_random_questions(test['id'], 3)
print(f" Примеры вопросов ({len(questions)} из CSV файла):")
for i, q in enumerate(questions, 1):
print(f" {i}. {q['question']}")
print(f" 1) {q['option1']}")
print(f" 2) {q['option2']}")
print(f" 3) {q['option3']}")
print(f" 4) {q['option4']}")
print(f" Правильный: {q['correct_answer']}")
print()
print("🎮 Доступные режимы:")
print(f" 🎯 Гостевой режим: {'✅ Включен' if config.guest_mode_enabled else '❌ Отключен'}")
print(f" 📚 Режим тестирования: {'✅ Включен' if config.test_mode_enabled else '❌ Отключен'}")
print()
print("⚙️ Настройки:")
print(f" 📁 База данных: {config.database_path}")
print(f" 📁 CSV файлы: {config.csv_data_path}")
print(f" 🎲 Вопросов в тесте: {config.questions_per_quiz}")
print(f" ⏱️ Время на вопрос: {config.time_per_question} сек")
print("\n📱 Команды бота:")
commands = [
("/start", "Главное меню с выбором режима"),
("/help", "Справка по командам"),
("/stats", "Статистика пользователя"),
("/stop", "Остановить текущий тест")
]
for cmd, desc in commands:
print(f" {cmd} - {desc}")
print("\n🚀 Для запуска настоящего бота:")
print(" 1. Получите токен у @BotFather")
print(" 2. Добавьте BOT_TOKEN в файл .env")
print(" 3. Запустите: python src/bot.py")
if __name__ == "__main__":
asyncio.run(demo())