add alarm of job
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pavel_Duron 2022-12-06 20:25:52 +10:00
parent 502dca273d
commit 45d4aa8c9a
5 changed files with 17 additions and 8 deletions

5
bot.py
View File

@ -1,11 +1,9 @@
from create_bot import dp
import logging
from aiogram import executor
from handlers import pipisa, time_new_year, start_help
from handlers import pipisa, time_new_year, start_help, coding
print('Бот начал работу')
logging.basicConfig(level=logging.DEBUG)
@ -13,6 +11,7 @@ logging.basicConfig(level=logging.DEBUG)
pipisa.register_handlers_pipisa(dp)
time_new_year.register_handlers_time(dp)
start_help.register_handlers_StartHelp(dp)
coding.register_handlers_alarm(dp)

View File

@ -1,3 +1,4 @@
from handlers import pipisa
from handlers import time_new_year
from handlers import start_help
from handlers import coding

12
handlers/coding.py Normal file
View File

@ -0,0 +1,12 @@
from aiogram import types, Dispatcher
from create_bot import bot, dp
from sqdb import user, session
@dp.message_handler(commands=['alarm'])
async def notify_chats(message: types.Message):
for chats in session.query(user.chat_id).distinct():
session.close()
await bot.send_message(chats,'<b>Ведутся пажилые работы,\n Ожидайте...</b>')
def register_handlers_alarm(dp: Dispatcher):
dp.register_message_handler(notify_chats)

View File

@ -44,7 +44,7 @@ async def up_dick(message: types.Message):
else:
session.close()
int_table = user(user_id = message.from_user.id, user_fullname = message.from_user.full_name, dick_size = numb, datetimes = datetime.datetime.now(),\
chat_id = message.chat.id)
session.add(int_table)

View File

@ -3,9 +3,6 @@ from create_bot import dp, bot
@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'])