python_bot/bot.py
Pavel_Duron 53ec3f8ef3
All checks were successful
continuous-integration/drone/push Build is passing
fix
2022-11-03 18:35:12 +10:00

60 lines
2.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from cgitb import text
import datetime
import logging
from aiogram import Bot, Dispatcher, executor, types
from aiogram.types import ReplyKeyboardRemove, ReplyKeyboardMarkup, KeyboardButton
API_TOKEN = '5724991559:AAEuLvpLsgP6LHRGMSyFtQLlR5qPQUO4b_w'
logging.basicConfig(level=logging.DEBUG)
bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(commands=["time"])
async def send_time(message: types.Message):
cd = datetime.datetime.now().strftime("%d/%m/%Y") #дата
ct = datetime.datetime.now() #датавремя
ct = ct+datetime.timedelta(hours=14) # +14 часов от сервера
ct2 = ct.strftime('%H:%M') # форматирует датувремя просто во время
new_year = datetime.date(2022, 12, 31).strftime("%d/%m/%Y")
differ = new_year - ct2.days
await message.reply(f'Сегодня {cd} \nВремя: {ct2} \nДо Нового Года осталось {differ} дней(-я)')
""""async def set_default_commands(dp):
await dp.bot.set_my_commands([
types.BotCommand("start", "Запустить бота"),
types.BotCommand("photo", "рандомная пикча"),
]) # отображает cписок команд но через бот фазер это проще"""
@dp.message_handler(commands=['start'])
async def start_func(message: types.Message):
# user_id = message.from_user.id
# user_full_name = message.from_user.full_name
# logging.INFO(f'{user_id=} {user_full_name=}', {time.asctime()})
await message.reply('похуй')
@dp.message_handler(commands=['photo'])
async def send_image(message: types.Message):
await bot.send_photo(message.chat.id, photo='https://memepedia.ru/wp-content/uploads/2018/08/ya-pidoras.jpg', reply_to_message_id=message.message_id)
@dp.message_handler(content_types=types.ContentTypes.TEXT)
async def send_faggot(message: types.Message):
print(message.text)
if message.text == 'хто я':
await bot.send_photo(message.chat.id, photo='https://www.meme-arsenal.com/memes/ecebd2339c7eab40e09874bd86a38a09.jpg')
#хуй
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True)