вывод времени
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pavel_Duron 2022-11-03 16:28:19 +10:00
parent 0e53b0d234
commit f8edff24e8

11
bot.py
View File

@ -1,7 +1,5 @@
from cgitb import text from cgitb import text
import time
import datetime import datetime
date = datetime
import logging import logging
from aiogram import Bot, Dispatcher, executor, types from aiogram import Bot, Dispatcher, executor, types
@ -14,11 +12,16 @@ logging.basicConfig(level=logging.DEBUG)
bot = Bot(token=API_TOKEN) bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot) dp = Dispatcher(bot)
current_time = datetime.datetime.now()
@dp.message_handler(commands=["time"]) @dp.message_handler(commands=["time"])
async def send_time(message: types.Message): async def send_time(message: types.Message):
await message.reply(current_time) #отображение времени, пока не рабоатет current_datatime = datetime.datetime.now()
current_data = current_datatime.date()
current_time = current_datatime.time()
new_year = datetime.date(2022, 12, 31)
await message.reply('Сегодня' + current_data + '\nВремя' + current_time + '\nДо нового года осталось') #отображение времени, пока не рабоатет
""""async def set_default_commands(dp): """"async def set_default_commands(dp):