init commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import pydantic
|
||||
import pydantic_settings
|
||||
|
||||
|
||||
class Config(pydantic_settings.BaseSettings):
|
||||
model_config = pydantic_settings.SettingsConfigDict(
|
||||
env_file='../.env',
|
||||
env_ignore_empty=True,
|
||||
extra='ignore',
|
||||
)
|
||||
|
||||
TOKEN_TELEGRAM_API: str = pydantic.fields.Field(default=None)
|
||||
WEB_APP_URL: str = pydantic.fields.Field(default=None)
|
||||
|
||||
|
||||
config = Config()
|
||||
@@ -0,0 +1,15 @@
|
||||
import aiogram.types
|
||||
|
||||
from app.core.config import config
|
||||
|
||||
inline_web_app_buttons = [
|
||||
[
|
||||
aiogram.types.InlineKeyboardButton(
|
||||
text='Запустить',
|
||||
web_app=aiogram.types.WebAppInfo(url=config.WEB_APP_URL),
|
||||
)
|
||||
]
|
||||
]
|
||||
inline_web_app = aiogram.types.InlineKeyboardMarkup(
|
||||
inline_keyboard=inline_web_app_buttons
|
||||
)
|
||||
@@ -0,0 +1,4 @@
|
||||
GREETING = """
|
||||
Добро пожаловать в CoPay!
|
||||
Используйте web-app для управления аккаунтом.
|
||||
"""
|
||||
@@ -0,0 +1,23 @@
|
||||
import asyncio
|
||||
import logging
|
||||
import sys
|
||||
|
||||
import aiogram.client.default
|
||||
import aiogram.dispatcher.dispatcher
|
||||
|
||||
from app.core.config import config
|
||||
import app.routing.routers
|
||||
|
||||
bot = aiogram.Bot(token=config.TOKEN_TELEGRAM_API)
|
||||
dp = aiogram.dispatcher.dispatcher.Dispatcher()
|
||||
|
||||
dp.include_router(app.routing.routers.routing_router)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
await dp.start_polling(bot)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
|
||||
asyncio.run(main())
|
||||
@@ -0,0 +1,4 @@
|
||||
__all__: list[str] = []
|
||||
|
||||
# Initialize all handlers
|
||||
from .handlers import *
|
||||
@@ -0,0 +1,4 @@
|
||||
__all__: list[str] = []
|
||||
|
||||
# Initialize all handlers
|
||||
from .handlers import *
|
||||
@@ -0,0 +1,13 @@
|
||||
import aiogram.filters
|
||||
import aiogram.types
|
||||
|
||||
import app.core.layouts
|
||||
import app.core.prompts
|
||||
from app.routing.base.routers import base_router
|
||||
|
||||
|
||||
@base_router.message(aiogram.filters.Command('start'))
|
||||
async def start(message: aiogram.types.Message) -> None:
|
||||
await message.reply(
|
||||
app.core.prompts.GREETING, reply_markup=app.core.layouts.inline_web_app
|
||||
)
|
||||
@@ -0,0 +1,3 @@
|
||||
import aiogram
|
||||
|
||||
base_router = aiogram.Router(name=__package__)
|
||||
@@ -0,0 +1,9 @@
|
||||
import aiogram
|
||||
|
||||
import app.routing.base.routers
|
||||
|
||||
routing_router = aiogram.Router(name=__package__)
|
||||
|
||||
routing_router.include_routers(
|
||||
app.routing.base.routers.base_router,
|
||||
)
|
||||
Reference in New Issue
Block a user