|
|
|
|
@ -52,10 +52,6 @@ def maxbot_send_menu_button(client: Client, chat_id: str, max_token: str, messag
|
|
|
|
|
button = []
|
|
|
|
|
cnt = 0
|
|
|
|
|
for mn in menu:
|
|
|
|
|
if cnt == 2:
|
|
|
|
|
cnt = 0
|
|
|
|
|
buttons.append(button)
|
|
|
|
|
button = []
|
|
|
|
|
if mn.emojii:
|
|
|
|
|
emojii = str(mn.emojii)
|
|
|
|
|
else:
|
|
|
|
|
@ -64,10 +60,14 @@ def maxbot_send_menu_button(client: Client, chat_id: str, max_token: str, messag
|
|
|
|
|
button_data = {"type": "callback", "text": " ".join([emojii, str(mn.title)]),
|
|
|
|
|
"payload": json.dumps(payload_data)}
|
|
|
|
|
button.append(button_data)
|
|
|
|
|
if cnt == 2 or str(mn.slug) == 'menu_1':
|
|
|
|
|
cnt = 0
|
|
|
|
|
buttons.append(button)
|
|
|
|
|
button = []
|
|
|
|
|
cnt = cnt + 1
|
|
|
|
|
|
|
|
|
|
buttons.append(button)
|
|
|
|
|
|
|
|
|
|
print(buttons)
|
|
|
|
|
payload = json.dumps({
|
|
|
|
|
"text": message,
|
|
|
|
|
"attachments": [
|
|
|
|
|
@ -212,7 +212,7 @@ def maxbot_send_month_button(client: Client, chat_id: str, max_token: str, messa
|
|
|
|
|
buttons.append(button)
|
|
|
|
|
button = []
|
|
|
|
|
payload_data = {"payload_type": "month_birthday", "data": dt}
|
|
|
|
|
button_data = {"type": "callback", "text": months[dt-1], "payload": json.dumps(payload_data)}
|
|
|
|
|
button_data = {"type": "callback", "text": months[dt - 1], "payload": json.dumps(payload_data)}
|
|
|
|
|
button.append(button_data)
|
|
|
|
|
cnt = cnt + 1
|
|
|
|
|
|
|
|
|
|
@ -256,3 +256,39 @@ def maxbot_send_content(client: Client, chat_id: str, max_token: str, message: s
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def maxbot_send_feedback_button(client: Client, chat_id: str, max_token: str, message: str):
|
|
|
|
|
url = f"https://platform-api.max.ru/messages?chat_id={chat_id}"
|
|
|
|
|
buttons = []
|
|
|
|
|
button = []
|
|
|
|
|
cnt = 0
|
|
|
|
|
for dt in range(1, 6):
|
|
|
|
|
payload_data = {"payload_type": "feedback", "data": f"feedback{dt}"}
|
|
|
|
|
button_data = {"type": "callback", "text": dt, "payload": json.dumps(payload_data)}
|
|
|
|
|
button.append(button_data)
|
|
|
|
|
cnt = cnt + 1
|
|
|
|
|
|
|
|
|
|
buttons.append(button)
|
|
|
|
|
|
|
|
|
|
payload = json.dumps({
|
|
|
|
|
"text": message,
|
|
|
|
|
"attachments": [
|
|
|
|
|
{"type": "inline_keyboard",
|
|
|
|
|
"payload": {
|
|
|
|
|
"buttons": buttons
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
headers = {
|
|
|
|
|
'Authorization': f'{max_token}',
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
|
|
rt = {'success': True, 'error': '', 'data': response}
|
|
|
|
|
|
|
|
|
|
return rt
|
|
|
|
|
|