Skeleton of project - database loading
This commit is contained in:
1
bot/handlers/__init__.py
Normal file
1
bot/handlers/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
pass
|
||||
1
bot/handlers/help/__init__.py
Normal file
1
bot/handlers/help/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
pass
|
||||
23
bot/handlers/help/help.py
Normal file
23
bot/handlers/help/help.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from aiogram import types
|
||||
from bot.common import dp
|
||||
from .help_strings import help_data
|
||||
|
||||
|
||||
@dp.message_handler(commands='help')
|
||||
async def help_command(message: types.Message):
|
||||
if message.get_args() == "":
|
||||
await message.reply(
|
||||
"\n".join(
|
||||
list(
|
||||
map(
|
||||
(lambda x: f"/{x} - {help_data.get(x) if help_data.get(x) else f'No info for {x}'}"),
|
||||
help_data.keys()
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
else:
|
||||
if help_data.get(message.get_args()):
|
||||
await message.reply(help_data.get(message.get_args()))
|
||||
else:
|
||||
await message.reply(f"No info for {message.get_args()}")
|
||||
2
bot/handlers/help/help_strings.py
Normal file
2
bot/handlers/help/help_strings.py
Normal file
@@ -0,0 +1,2 @@
|
||||
help_data = {
|
||||
}
|
||||
1
bot/handlers/initialize/__init__.py
Normal file
1
bot/handlers/initialize/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
pass
|
||||
7
bot/handlers/initialize/pull_db.py
Normal file
7
bot/handlers/initialize/pull_db.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from bot.common import dp
|
||||
from bot.db.pull_db import pull
|
||||
|
||||
|
||||
@dp.message_handler()
|
||||
async def pull_db_if_new(_):
|
||||
await pull()
|
||||
11
bot/handlers/register.py
Normal file
11
bot/handlers/register.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from rich import print
|
||||
|
||||
|
||||
def import_handlers():
|
||||
import bot.handlers.help.help
|
||||
assert bot.handlers.help.help
|
||||
|
||||
import bot.handlers.initialize.pull_db
|
||||
assert bot.handlers.initialize.pull_db
|
||||
|
||||
print('[gray]All handlers imported[/]')
|
||||
Reference in New Issue
Block a user