ANTICHAT

ANTICHAT (https://forum.antichat.xyz/index.php)
-   Общие вопросы программирования (https://forum.antichat.xyz/forumdisplay.php?f=206)
-   -   Бот вк (https://forum.antichat.xyz/showthread.php?t=1357359)

Tema05 14.06.2020 19:33

Проблема в том что как только я добавляю ещё 1 кнопку бот перестаёт работать

Использую php и vk api 5.103. Ниже есть пример как я отображаю кнопки и он полностью работает.

Но как только я в 3 линии добавляю 4тую кнопку с надписью '13' бот перестаёт работать и отображать кнопки. Ниже показан нерабочий пример.

Добавлением данной кнопки я не нарушаю максимальные размеры 5x10 и лимит в 40 кнопок указанный в документации.

PHP:





Код:

//РАБОТАЕТ
'keyboard'
=
>
json_encode
(
[
'buttons'
=
>
[
[
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"1"}'
,
'label'
=
>
'1'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"2"}'
,
'label'
=
>
'2'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"3"}'
,
'label'
=
>
'3'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"4"}'
,
'label'
=
>
'4'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"5"}'
,
'label'
=
>
'5'
]
,
'color'
=
>
'negative'
]
]
,
[
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"6"}'
,
'label'
=
>
'6'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"7"}'
,
'label'
=
>
'7'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"8"}'
,
'label'
=
>
'8'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"9"}'
,
'label'
=
>
'9'
]
,
'color'
=
>
'negative'
]
]
,
[
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"10"}'
,
'label'
=
>
'10'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"11"}'
,
'label'
=
>
'11'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"12"}'
,
'label'
=
>
'12'
]
,
'color'
=
>
'negative'
]
]
,
[
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"menu"}'
,
'label'
=
>
'❌'
]
,
'color'
=
>
'primary'
]
]
]
]
,
JSON_UNESCAPED_UNICODE
)



PHP:





Код:

//НЕ РАБОТАЕТ
'keyboard'
=
>
json_encode
(
[
'buttons'
=
>
[
[
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"1"}'
,
'label'
=
>
'1'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"2"}'
,
'label'
=
>
'2'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"3"}'
,
'label'
=
>
'3'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"4"}'
,
'label'
=
>
'4'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"5"}'
,
'label'
=
>
'5'
]
,
'color'
=
>
'negative'
]
]
,
[
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"6"}'
,
'label'
=
>
'6'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"7"}'
,
'label'
=
>
'7'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"8"}'
,
'label'
=
>
'8'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"9"}'
,
'label'
=
>
'9'
]
,
'color'
=
>
'negative'
]
]
,
[
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"10"}'
,
'label'
=
>
'10'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"11"}'
,
'label'
=
>
'11'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"12"}'
,
'label'
=
>
'12'
]
,
'color'
=
>
'negative'
]
,
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"statistics_server", "server_id":"13"}'
,
'label'
=
>
'13'
]
,
'color'
=
>
'negative'
]
]
,
[
[
'action'
=
>
[
'type'
=
>
'text'
,
'payload'
=
>
'{"button":"menu"}'
,
'label'
=
>
'❌'
]
,
'color'
=
>
'primary'
]
]
]
]
,
JSON_UNESCAPED_UNICODE
)



Время: 06:52