
04.05.2020, 22:54
|
|
Познавший АНТИЧАТ
Регистрация: 05.10.2019
Сообщений: 1,649
С нами:
3477805
Репутация:
168
|
|
Сообщение от karimoff
Отправь сюда функцию sendButton()
PHP:
Код:
public
function
sendButton
(
$sendID
,
$message
,
$gl_massiv
=
[
]
,
$one_time
=
False
)
{
$buttons
=
[
]
;
$i
=
0
;
foreach
(
$gl_massiv
as
$button_str
)
{
$j
=
0
;
foreach
(
$button_str
as
$button
)
{
$color
=
$this
-
>
replaceColor
(
$button
[
2
]
)
;
$buttons
[
$i
]
[
$j
]
[
"action"
]
[
"type"
]
=
"text"
;
if
(
$button
[
0
]
!=
null
)
$buttons
[
$i
]
[
$j
]
[
"action"
]
[
"payload"
]
=
json_encode
(
$button
[
0
]
,
JSON_UNESCAPED_UNICODE
)
;
$buttons
[
$i
]
[
$j
]
[
"action"
]
[
"label"
]
=
$button
[
1
]
;
$buttons
[
$i
]
[
$j
]
[
"color"
]
=
$color
;
$j
++
;
}
$i
++
;
}
$buttons
=
array
(
"one_time"
=
>
$one_time
,
"buttons"
=
>
$buttons
)
;
$buttons
=
json_encode
(
$buttons
,
JSON_UNESCAPED_UNICODE
)
;
//echo $buttons;
return
$this
-
>
request
(
'messages.send'
,
array
(
'message'
=
>
$message
,
'peer_id'
=
>
$sendID
,
'keyboard'
=
>
$buttons
)
)
;
}
|
|
|