|
|
|
|
@ -59,21 +59,21 @@ def maxbot_send_menu_button(chat_id: str, max_token: str, message: str, buton: l
|
|
|
|
|
"url": "https://example.com"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"type": "link",
|
|
|
|
|
"text": "Закройте сайт",
|
|
|
|
|
"type": "message",
|
|
|
|
|
"text": "type message",
|
|
|
|
|
"url": "https://example.com"
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"type": "link",
|
|
|
|
|
"text": "Откройте сайт",
|
|
|
|
|
"url": "https://example.com"
|
|
|
|
|
"type": "clipboard",
|
|
|
|
|
"text": "type clipboard",
|
|
|
|
|
"payload": "test"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"type": "link",
|
|
|
|
|
"text": " 🍺 Закройте сайт",
|
|
|
|
|
"url": "https://example.com"
|
|
|
|
|
"type": "callback",
|
|
|
|
|
"text": " 🍺 callback",
|
|
|
|
|
"payload": "TEEEETE payload"
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
@ -90,3 +90,41 @@ def maxbot_send_menu_button(chat_id: str, max_token: str, message: str, buton: l
|
|
|
|
|
rt = {'success': True, 'error': '', 'data': response}
|
|
|
|
|
|
|
|
|
|
return rt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def maxbot_get_all_messages(chat_id: str, max_token: str):
|
|
|
|
|
url = f"https://platform-api.max.ru/messages?chat_id={chat_id}"
|
|
|
|
|
|
|
|
|
|
payload = {}
|
|
|
|
|
headers = {
|
|
|
|
|
'Authorization': f'{max_token}',
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
response = requests.request("GET", url, headers=headers, data=payload)
|
|
|
|
|
rt = {'success': True, 'error': '', 'data': response.json()}
|
|
|
|
|
|
|
|
|
|
return rt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def maxbot_del_messages(max_token: str, message_id: str):
|
|
|
|
|
url = f"https://platform-api.max.ru/messages?message_id={message_id}"
|
|
|
|
|
|
|
|
|
|
payload = {}
|
|
|
|
|
headers = {
|
|
|
|
|
'Authorization': f'{max_token}',
|
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
|
}
|
|
|
|
|
response = requests.request("DELETE", url, headers=headers, data=payload)
|
|
|
|
|
rt = {'success': True, 'error': '', 'data': response.json()}
|
|
|
|
|
|
|
|
|
|
return rt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def maxbot_delete_all_messages(chat_id: str, max_token: str):
|
|
|
|
|
rt = maxbot_get_all_messages(chat_id=chat_id, max_token=max_token)
|
|
|
|
|
data = rt['data']
|
|
|
|
|
for dt in data['messages']:
|
|
|
|
|
if dt['sender']['is_bot']:
|
|
|
|
|
maxbot_del_messages(max_token=max_token, message_id=dt['body']['mid'])
|
|
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
|