from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
import asyncio
from datetime import datetime
bot = Bot(token=os.getenv('TOKEN'))
dp = Dispatcher(bot)
@dp.message_handler(commands=['start'])
async def command_start(message : types.Message):
while True:
await asyncio.sleep(1)
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
if current_time == '23:44:01':
await bot.send_message(message.chat.id, f'"Это сообщение отправлено в {current_time}"')
@dp.message_handler(commands=['mess'])
async def command(message : types.Message):
await bot.send_message(message.chat.id, 'Для полной картины, асинхронность работает')
executor.start_polling(dp, skip_updates=True)