diff --git a/examples/regexp_commands_filter_example.py b/examples/regexp_commands_filter_example.py index 86ccba55..05de9dd8 100644 --- a/examples/regexp_commands_filter_example.py +++ b/examples/regexp_commands_filter_example.py @@ -2,14 +2,28 @@ from aiogram import Bot, types from aiogram.dispatcher import Dispatcher, filters from aiogram.utils import executor -bot = Bot(token='TOKEN') + +bot = Bot(token='BOT_TOKEN_HERE', parse_mode=types.ParseMode.HTML) dp = Dispatcher(bot) @dp.message_handler(filters.RegexpCommandsFilter(regexp_commands=['item_([0-9]*)'])) async def send_welcome(message: types.Message, regexp_command): - await message.reply("You have requested an item with number: {}".format(regexp_command.group(1))) + await message.reply(f"You have requested an item with id {regexp_command.group(1)}") + + +@dp.message_handler(commands='start') +async def create_deeplink(message: types.Message): + bot_user = await bot.me + bot_username = bot_user.username + deeplink = f'https://t.me/{bot_username}?start=item_12345' + text = ( + f'Either send a command /item_1234 or follow this link {deeplink} and then click start\n' + 'It also can be hidden in a inline button\n\n' + 'Or just send /start item_123' + ) + await message.reply(text, disable_web_page_preview=True) if __name__ == '__main__': - executor.start_polling(dp) + executor.start_polling(dp, skip_updates=True)