Python
- 1 ответ
- 0 вопросов
0
Вклад в тег
from datetime import datetime, timedelta
import config as cfg
from aiogram import Bot, executor, types
from aiogram.dispatcher import Dispatcher
from apscheduler.schedulers.asyncio import AsyncIOScheduler
bot = Bot(token=cfg.token, validate_token=True, parse_mode="HTML")
dp = Dispatcher(bot)
scheduler = AsyncIOScheduler()
scheduler.start()
@dp.message_handler(content_types=types.ContentTypes.TEXT)
async def send_msg(message: types.Message):
msg = await message.answer("Тик")
date = datetime.now() + timedelta(minutes=3)
scheduler.add_job(edit_msg, "date", run_date=date, kwargs={"message": msg})
async def edit_msg(message: types.Message):
await message.edit_text("Так")
if __name__ == "__main__":
executor.start_polling(dp, skip_updates=True)
Please note, that it is currently only possible to edit messages without reply_markup or with inline keyboards.