moved project to package, format pep8, removed unused dependency

This commit is contained in:
kiriharu 2021-01-03 15:19:06 +03:00
parent a989d52680
commit 4f0b36656c
8 changed files with 9 additions and 16 deletions

View File

@ -1,10 +0,0 @@
import os
from dotenv import load_dotenv
dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path)
# Loading token from .env
TELEGRAM_BOT_TOKEN = os.getenv("TELEGRAM_BOT_TOKEN")

View File

@ -1 +0,0 @@
from . import default

View File

@ -1,6 +1,5 @@
from aiogram import Bot, Dispatcher, executor
from aiogram.contrib.fsm_storage.memory import MemoryStorage
from loguru import logger
import config
import handlers
@ -9,10 +8,11 @@ storage = MemoryStorage()
telegram_bot = Bot(token=config.TELEGRAM_BOT_TOKEN)
dp = Dispatcher(telegram_bot, storage=storage)
def on_startup():
logger.info('Registering handlers')
handlers.default.setup(dp)
if __name__ == '__main__':
on_startup()
executor.start_polling(dp,skip_updates=True)
executor.start_polling(dp, skip_updates=True)

View File

@ -0,0 +1,4 @@
import os
# Loading token from .env
TELEGRAM_BOT_TOKEN = os.getenv("TELEGRAM_BOT_TOKEN")

View File

@ -0,0 +1 @@
from . import default

View File

@ -2,5 +2,6 @@ from aiogram import Dispatcher
from .start import start_cmd
def setup(dp: Dispatcher):
dp.register_message_handler(start_cmd, commands=['start'])

View File

@ -1,7 +1,5 @@
from aiogram.types import Message
from loguru import logger
async def start_cmd(msg: Message):
logger.info(f"{msg.from_user.full_name} send /start")
await msg.answer("Basic reply")