forked from Pavel_Durov/python_bot
вывод времени
This commit is contained in:
parent
0e53b0d234
commit
f8edff24e8
11
bot.py
11
bot.py
@ -1,7 +1,5 @@
|
||||
from cgitb import text
|
||||
import time
|
||||
import datetime
|
||||
date = datetime
|
||||
import logging
|
||||
|
||||
from aiogram import Bot, Dispatcher, executor, types
|
||||
@ -14,11 +12,16 @@ logging.basicConfig(level=logging.DEBUG)
|
||||
bot = Bot(token=API_TOKEN)
|
||||
dp = Dispatcher(bot)
|
||||
|
||||
current_time = datetime.datetime.now()
|
||||
|
||||
|
||||
@dp.message_handler(commands=["time"])
|
||||
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):
|
||||
|
Loading…
Reference in New Issue
Block a user