mirror of
https://github.com/catspace-dev/unicheckbot.git
synced 2024-11-21 13:36:37 +03:00
better structure
This commit is contained in:
parent
723172387b
commit
784cae145d
|
@ -10,4 +10,4 @@ RUN apk update \
|
|||
COPY . .
|
||||
WORKDIR tgbot
|
||||
RUN pip install --upgrade pip; pip install poetry; poetry config virtualenvs.create false; poetry install
|
||||
CMD poetry shell; python bot.py
|
||||
CMD poetry run tgbot
|
||||
|
|
|
@ -23,3 +23,6 @@ flake8 = "^3.8.4"
|
|||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
tgbot = "tgbot.bot:main"
|
|
@ -1,12 +1,12 @@
|
|||
from aiogram import Bot, Dispatcher, executor
|
||||
from aiogram.contrib.fsm_storage.memory import MemoryStorage
|
||||
from tgbot.middlewares import UserMiddleware, WriteCommandMetric, LoggingMiddleware, ThrottlingMiddleware
|
||||
from .middlewares import UserMiddleware, WriteCommandMetric, LoggingMiddleware, ThrottlingMiddleware
|
||||
from tortoise import Tortoise
|
||||
from tortoise.exceptions import DBConnectionError
|
||||
from loguru import logger
|
||||
from asyncio import sleep
|
||||
import tgbot.config as config
|
||||
import tgbot.handlers as handlers
|
||||
from . import config
|
||||
from . import handlers
|
||||
|
||||
storage = MemoryStorage()
|
||||
telegram_bot = Bot(token=config.TELEGRAM_BOT_TOKEN)
|
||||
|
@ -42,5 +42,10 @@ async def on_startup(disp: Dispatcher):
|
|||
disp.middleware.setup(LoggingMiddleware())
|
||||
disp.middleware.setup(UserMiddleware())
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
def main():
|
||||
executor.start_polling(dp, skip_updates=True, on_startup=on_startup)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in New Issue
Block a user