From 2c6f82bfb570282cf6a22e9839fd5224379efe9b Mon Sep 17 00:00:00 2001 From: grigorij Date: Wed, 10 Jun 2026 22:51:56 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B1=D0=B0=D0=B7=D0=BE=D0=B2=D0=B0=D1=8F=20?= =?UTF-8?q?=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=82=D1=83=D1=80=D0=B0=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=B0=20Telegram-=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=B0=20(handlers,=20config,=20memory)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 1 + .idea/.gitignore | 5 ++++ .idea/PythonProject.iml | 10 +++++++ .idea/inspectionProfiles/Project_Default.xml | 13 +++++++++ .../inspectionProfiles/profiles_settings.xml | 6 ++++ .idea/misc.xml | 7 +++++ .idea/modules.xml | 8 +++++ .idea/vcs.xml | 6 ++++ app/config.py | 9 ++++++ app/db/memory.py | 1 + app/handlers/start.py | 8 +++++ app/keyboards/menu.py | 0 app/states/booking.py | 0 main.py | 29 ++++++++++++------- requirements.txt | 2 ++ 15 files changed, 94 insertions(+), 11 deletions(-) create mode 100644 .env create mode 100644 .idea/.gitignore create mode 100644 .idea/PythonProject.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 app/config.py create mode 100644 app/db/memory.py create mode 100644 app/handlers/start.py create mode 100644 app/keyboards/menu.py create mode 100644 app/states/booking.py create mode 100644 requirements.txt diff --git a/.env b/.env new file mode 100644 index 0000000..bde5482 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +BOT_TOKEN=8918896220:AAHuo36Lo9PEeXVNongKJbr2WLZn5xxy1GQ \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/PythonProject.iml b/.idea/PythonProject.iml new file mode 100644 index 0000000..157f929 --- /dev/null +++ b/.idea/PythonProject.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..1b93a53 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..c7ae335 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..5f43230 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/config.py b/app/config.py new file mode 100644 index 0000000..27036cd --- /dev/null +++ b/app/config.py @@ -0,0 +1,9 @@ +import os +from dotenv import load_dotenv + +load_dotenv() + +BOT_TOKEN = os.getenv("BOT_TOKEN") + +if not BOT_TOKEN: + raise ValueError("BOT_TOKEN не найден") \ No newline at end of file diff --git a/app/db/memory.py b/app/db/memory.py new file mode 100644 index 0000000..34c0968 --- /dev/null +++ b/app/db/memory.py @@ -0,0 +1 @@ +BOOKINGS = {} \ No newline at end of file diff --git a/app/handlers/start.py b/app/handlers/start.py new file mode 100644 index 0000000..8e5223d --- /dev/null +++ b/app/handlers/start.py @@ -0,0 +1,8 @@ +from aiogram import Router, F +from aiogram.types import Message + +router = Router() + +@router.message(F.text == "/start") +async def start(message: Message): + await message.answer("👋 Бот запущен (чистый старт)") \ No newline at end of file diff --git a/app/keyboards/menu.py b/app/keyboards/menu.py new file mode 100644 index 0000000..e69de29 diff --git a/app/states/booking.py b/app/states/booking.py new file mode 100644 index 0000000..e69de29 diff --git a/main.py b/main.py index 94e3a87..b965ac6 100644 --- a/main.py +++ b/main.py @@ -1,16 +1,23 @@ -# This is a sample Python script. +import asyncio +import logging -# Press ⌃R to execute it or replace it with your code. -# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings. +from aiogram import Bot, Dispatcher +from aiogram.fsm.storage.memory import MemoryStorage + +from app.config import BOT_TOKEN +from app.handlers import start + +logging.basicConfig(level=logging.INFO) -def print_hi(name): - # Use a breakpoint in the code line below to debug your script. - print(f'Hi, {name}') # Press ⌘F8 to toggle the breakpoint. +async def main(): + bot = Bot(token=BOT_TOKEN) + dp = Dispatcher(storage=MemoryStorage()) + + dp.include_router(start.router) + + await dp.start_polling(bot) -# Press the green button in the gutter to run the script. -if __name__ == '__main__': - print_hi('PyCharm') - -# See PyCharm help at https://www.jetbrains.com/help/pycharm/ +if __name__ == "__main__": + asyncio.run(main()) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0e6b280 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +aiogram +python-dotenv \ No newline at end of file