forked from Pavel_Durov/python_bot
add alarm of job
This commit is contained in:
parent
502dca273d
commit
45d4aa8c9a
5
bot.py
5
bot.py
@ -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)
|
||||
|
||||
|
||||
|
||||
|
@ -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
12
handlers/coding.py
Normal 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)
|
@ -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)
|
||||
|
@ -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'])
|
||||
|
Loading…
Reference in New Issue
Block a user