mirror of
https://github.com/catspace-dev/unicheckbot.git
synced 2024-11-22 05:46:33 +03:00
moved project to package, format pep8, removed unused dependency
This commit is contained in:
parent
a989d52680
commit
4f0b36656c
|
@ -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")
|
|
@ -1 +0,0 @@
|
|||
from . import default
|
|
@ -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)
|
4
apps/tgbot/tgbot/config.py
Normal file
4
apps/tgbot/tgbot/config.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
import os
|
||||
|
||||
# Loading token from .env
|
||||
TELEGRAM_BOT_TOKEN = os.getenv("TELEGRAM_BOT_TOKEN")
|
1
apps/tgbot/tgbot/handlers/__init__.py
Normal file
1
apps/tgbot/tgbot/handlers/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
from . import default
|
|
@ -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'])
|
|
@ -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")
|
Loading…
Reference in New Issue
Block a user