sendButton ( $id , [ [ [ "" , "Не понял вас" , "red" ] , [ "" , "Спасибо за помощь" , "green" ] ] , [ [ "" , "Можно подробнее" , "blue" ] , [ "" , "Как это сделать?" , "blue" ] ] , [ [ "menu" , "Вернуться в меню" , "blue" ] ] ] )
public function sendButton ( $sendID , $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 ( 'peer_id' = > $sendID , 'keyboard' = > $buttons ) ) ; }