|
|
|
@ -75,7 +75,6 @@ def get_attachments(message: dict):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def bot_message(client: Client, message: dict, settings: dict, message_type):
|
|
|
|
def bot_message(client: Client, message: dict, settings: dict, message_type):
|
|
|
|
|
|
|
|
|
|
|
|
chat_id = message['message']['recipient']['chat_id']
|
|
|
|
chat_id = message['message']['recipient']['chat_id']
|
|
|
|
attachments = get_attachments(message=message)
|
|
|
|
attachments = get_attachments(message=message)
|
|
|
|
|
|
|
|
|
|
|
|
@ -94,8 +93,8 @@ def bot_message(client: Client, message: dict, settings: dict, message_type):
|
|
|
|
data = common_get_data(client=client, key=str(message['message']['body']['text']).lower())
|
|
|
|
data = common_get_data(client=client, key=str(message['message']['body']['text']).lower())
|
|
|
|
|
|
|
|
|
|
|
|
if message_type == 'message_callback':
|
|
|
|
if message_type == 'message_callback':
|
|
|
|
key = json.loads(message['callback']['payload'])
|
|
|
|
payload = json.loads(message['callback']['payload'])
|
|
|
|
data = common_get_data(client=client, key=str(key['data']).lower())
|
|
|
|
data = common_get_data(client=client, key=str(payload['data']).lower())
|
|
|
|
if data:
|
|
|
|
if data:
|
|
|
|
for dt in data:
|
|
|
|
for dt in data:
|
|
|
|
if dt.title == '##bonus##':
|
|
|
|
if dt.title == '##bonus##':
|
|
|
|
@ -107,12 +106,17 @@ def bot_message(client: Client, message: dict, settings: dict, message_type):
|
|
|
|
|
|
|
|
|
|
|
|
bonus = get_bonus(client=client, phone=contact.phone, default_bonus=float(dt.price), contact=contact)
|
|
|
|
bonus = get_bonus(client=client, phone=contact.phone, default_bonus=float(dt.price), contact=contact)
|
|
|
|
maxbot_send_text_message(chat_id=chat_id, max_token=settings['token'],
|
|
|
|
maxbot_send_text_message(chat_id=chat_id, max_token=settings['token'],
|
|
|
|
message=f"Ваши бонусы: {bonus} руб")
|
|
|
|
message=f"💰 Ваш бонусный баланс: {bonus} руб")
|
|
|
|
|
|
|
|
|
|
|
|
if dt.title == '##feedback##':
|
|
|
|
if dt.title == '##feedback##':
|
|
|
|
maxbot_send_feedback_button(client=client, message='👇', chat_id=chat_id, max_token=settings['token'])
|
|
|
|
maxbot_send_feedback_button(client=client, message='👇', chat_id=chat_id, max_token=settings['token'])
|
|
|
|
return True
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if dt.title == '##booking##':
|
|
|
|
|
|
|
|
maxbot_send_booking_count_people_button(client=client, message='👇',
|
|
|
|
|
|
|
|
chat_id=chat_id, max_token=settings['token'])
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
if dt.img:
|
|
|
|
if dt.img:
|
|
|
|
url = f"https://cdn.telefon-ip.ru/{dt.img}?thumb=600"
|
|
|
|
url = f"https://cdn.telefon-ip.ru/{dt.img}?thumb=600"
|
|
|
|
maxbot_send_img_message(chat_id=chat_id, max_token=settings['token'], img=url, message=dt.descr)
|
|
|
|
maxbot_send_img_message(chat_id=chat_id, max_token=settings['token'], img=url, message=dt.descr)
|
|
|
|
@ -126,6 +130,9 @@ def bot_message(client: Client, message: dict, settings: dict, message_type):
|
|
|
|
# отправка меню
|
|
|
|
# отправка меню
|
|
|
|
maxbot_send_menu_button(chat_id=chat_id, max_token=settings['token'], message='👇 Выбери раздел', client=client)
|
|
|
|
maxbot_send_menu_button(chat_id=chat_id, max_token=settings['token'], message='👇 Выбери раздел', client=client)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
|
|
|
|
if payload['payload_type'] == 'booking_count_people':
|
|
|
|
|
|
|
|
print('запрос даты')
|
|
|
|
|
|
|
|
|
|
|
|
# отправка меню
|
|
|
|
# отправка меню
|
|
|
|
maxbot_send_menu_button(chat_id=chat_id, max_token=settings['token'], message='👇 Выбери раздел', client=client)
|
|
|
|
maxbot_send_menu_button(chat_id=chat_id, max_token=settings['token'], message='👇 Выбери раздел', client=client)
|
|
|
|
|
|
|
|
|
|
|
|
|