Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def rules(sender_id, message):
- user = User.select().where(User.user_id == sender_id).get()
- oferta = Oferta.get(Oferta.oferta_id == 1)
- if message.text != bs.back:
- if message.text != bs.accept:
- if re.match(r'^((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{3,10}$', message.text):
- user.mobile = message.text
- else:
- bot.send_message(sender_id, bs.mobile_error)
- return False
- else:
- order =SentOrder.select().where(SentOrder.user_id == sender_id).order_by(-SentOrder.order_id).get()
- user.mobile = order.mobile
- markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
- agreement_button = types.KeyboardButton(bs.agreement)
- back_button = types.KeyboardButton(bs.back)
- cancel_button = types.KeyboardButton(bs.cancel)
- markup.add(agreement_button)
- markup.add(back_button)
- markup.add(cancel_button)
- bot.send_message(sender_id, bs.rules.format(oferta.link), reply_markup=markup, parse_mode="Markdown")
- user.step += 1
- user.save()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement