Skip to content

Commit

Permalink
add check correct url
Browse files Browse the repository at this point in the history
  • Loading branch information
krankir committed Jul 14, 2023
1 parent 07dff14 commit 60b2981
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mvideo_scrap_bot/mvideo_scrap_price_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,15 @@ async def delete_product(message: types.Message, state: FSMContext):
lambda message: 'Добавить товар на мониторинг' in message.text)
async def add_product(message: types.Message):
"""Добавление товара на мониторинг."""
text_ = 'Напишите ссылку на товар с сайта М.видео'
await message.answer(text_)
await message.answer('Напишите ссылку на товар с сайта М.видео')
await ChoiceLincProduct.product_linc.set()


@dp.message_handler(state=ChoiceLincProduct.product_linc)
async def www_par(message: types.Message, state: FSMContext):
"""Добавление товара на мониторинг."""
if message.text[:31] != 'https://www.mvideo.ru/products/':
await message.answer('❌ Некорректная ссылка на товар.')
return
await state.update_data(product_linc=message.text)
data = await state.get_data()
linc = data.get('product_linc')
Expand Down

0 comments on commit 60b2981

Please sign in to comment.