Separated loader with dp, bot and storage and added app,
which we'll be executing
This commit is contained in:
parent
eab45a5088
commit
43b241d4e7
|
@ -6,4 +6,4 @@ COPY requirements.txt /botname/
|
|||
RUN pip install -r /botname/requirements.txt
|
||||
COPY . /botname/
|
||||
|
||||
CMD python3 /botname/bot.py
|
||||
CMD python3 /botname/app.py
|
||||
|
|
23
app.py
Normal file
23
app.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
from loader import bot, storage
|
||||
|
||||
|
||||
async def on_startup(dp):
|
||||
import filters
|
||||
import middlewares
|
||||
filters.setup(dp)
|
||||
middlewares.setup(dp)
|
||||
|
||||
from utils.notify_admins import on_startup_notify
|
||||
await on_startup_notify(dp)
|
||||
|
||||
|
||||
async def on_shutdown(dp):
|
||||
await bot.close()
|
||||
await storage.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from aiogram import executor
|
||||
from handlers import dp
|
||||
|
||||
executor.start_polling(dp, on_startup=on_startup)
|
|
@ -1,6 +1,6 @@
|
|||
import logging
|
||||
|
||||
from bot import dp
|
||||
from loader import dp
|
||||
|
||||
|
||||
@dp.errors_handler()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from aiogram import types
|
||||
from bot import dp
|
||||
from loader import dp
|
||||
|
||||
|
||||
@dp.message_handler()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from aiogram import types
|
||||
from aiogram.dispatcher.filters.builtin import CommandStart
|
||||
|
||||
from bot import dp
|
||||
from loader import dp
|
||||
from utils.misc import rate_limit
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from aiogram import types
|
||||
from aiogram.dispatcher.filters.builtin import CommandStart
|
||||
|
||||
from bot import dp
|
||||
from loader import dp
|
||||
|
||||
|
||||
@dp.message_handler(CommandStart())
|
||||
|
|
|
@ -12,25 +12,3 @@ logging.basicConfig(format=u'%(filename)s [LINE:%(lineno)d] #%(levelname)-8s [%(
|
|||
level=logging.INFO,
|
||||
# level=logging.DEBUG,
|
||||
)
|
||||
|
||||
|
||||
async def on_startup(dp):
|
||||
import filters
|
||||
import middlewares
|
||||
filters.setup(dp)
|
||||
middlewares.setup(dp)
|
||||
|
||||
from utils.notify_admins import on_startup_notify
|
||||
await on_startup_notify(dp)
|
||||
|
||||
|
||||
async def on_shutdown(dp):
|
||||
await bot.close()
|
||||
await storage.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from aiogram import executor
|
||||
from handlers import dp
|
||||
|
||||
executor.start_polling(dp, on_startup=on_startup)
|
Loading…
Reference in New Issue
Block a user