Бот + прокси
This commit is contained in:
30
bot/commands.py
Normal file
30
bot/commands.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from argparse import Namespace
|
||||
|
||||
from aiogram import Router
|
||||
from aiogram.filters.command import Command, CommandStart
|
||||
from aiogram.types import Message
|
||||
|
||||
from bot.factory import bot
|
||||
from tracker.commands import end_workday
|
||||
|
||||
|
||||
router = Router()
|
||||
|
||||
@router.message(CommandStart())
|
||||
async def start_command(message: Message):
|
||||
await message.answer(f"Привет, {message.from_user.first_name}!")
|
||||
|
||||
|
||||
@router.message(Command("track"))
|
||||
async def track_command(message: Message):
|
||||
await message.answer("Эта фича пока в разработке, но скоро она поможет стартовать и останавливать таймер.")
|
||||
|
||||
|
||||
@router.message(Command("end"))
|
||||
async def end_command(message: Message):
|
||||
args = message.text.replace("/end", "").strip().split()
|
||||
if "-i" in args or "--init-db" in args:
|
||||
args = Namespace(init_db=True)
|
||||
await message.answer("Начинаю процесс занесения трудочасов...")
|
||||
await end_workday(args, bot, message.from_user.id)
|
||||
await message.answer("Трудочасы занесены!")
|
||||
Reference in New Issue
Block a user