Добавлена базовая структура проекта Telegram-бота (handlers, config, memory)
This commit is contained in:
Generated
+5
@@ -0,0 +1,5 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
Generated
+10
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="jdk" jdkName="Python 3.14 (PythonProject) (2)" jdkType="Python SDK" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="ignoredPackages">
|
||||||
|
<list>
|
||||||
|
<option value="aiogram" />
|
||||||
|
<option value="python-dotenv" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
Generated
+7
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Black">
|
||||||
|
<option name="sdkName" value="Python 3.14 (PythonProject) (2)" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.14 (PythonProject) (2)" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
||||||
Generated
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/PythonProject.iml" filepath="$PROJECT_DIR$/.idea/PythonProject.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
Generated
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -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 не найден")
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
BOOKINGS = {}
|
||||||
@@ -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("👋 Бот запущен (чистый старт)")
|
||||||
@@ -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.
|
from aiogram import Bot, Dispatcher
|
||||||
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
|
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):
|
async def main():
|
||||||
# Use a breakpoint in the code line below to debug your script.
|
bot = Bot(token=BOT_TOKEN)
|
||||||
print(f'Hi, {name}') # Press ⌘F8 to toggle the breakpoint.
|
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__":
|
||||||
if __name__ == '__main__':
|
asyncio.run(main())
|
||||||
print_hi('PyCharm')
|
|
||||||
|
|
||||||
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
aiogram
|
||||||
|
python-dotenv
|
||||||
Reference in New Issue
Block a user