cmmnt / bot
PHP ru.community bot
v0.1
2021-11-16 09:11 UTC
Requires
- php: >=5.1.0
This package is not auto-updated.
Last update: 2025-06-11 02:05:46 UTC
README
Установка
composer require cmmnt/bot
Получение token
curl --location --request PUT 'http://app.cmmnt.net/api/bot/' \
--data-urlencode 'id=bot' \
--data-urlencode 'name=Name bot'
Пример создания бота
<?php
$token='token'
$bot=new CmmntBot\Bot($token);
$data = file_get_contents("php://input");
$json=json_decode($data,true);
$cmd=urldecode($json['body']);
$from=$json['from'];
$sign=$json['sign'];
$element=array(
array(
'name'=>'row',
'attr'=>array(
'titleColor'=>'ffffff',
'backgroundColor'=>'75a6f4'
),
'data'=>array(
array(
'name'=>'button',
'label'=>'help',
'callback_data'=>'/help'
)
)
)
);
$msg="/help - help\n";
$bot->sendMessage($sign,$from,$msg,$element);