replace-bot/handlers/callback/timetable.py

21 lines
509 B
Python
Raw Normal View History

2023-02-19 01:51:52 +03:00
import io
import json
from aiogram import types
from load import dp, bot
from keyboards.inline.timetable import timetable
@dp.callback_query_handler(lambda c: c.data.split("|")[0] == "timetable")
async def callback_table(query: types.CallbackQuery):
message = query.message
group = query.data.split("|")[1]
file = timetable(group)
for f in file:
await bot.send_photo(
message.chat.id,
io.BytesIO(open(f, 'rb').read())
)
await query.answer()