Initial commit

parents
<?php
header('Content-Type: text/html; charset=utf-8');
// подрубаем API
require_once("vendor/autoload.php");
use TelegramBot\Api\Types\Location;
// создаем переменную бота
$token = "477050426:AAHJxiyYC5gmZTEIuzRH8i12BKb32vYLq8I";
$bot = new \TelegramBot\Api\Client($token);
// если бот еще не зарегистрирован - регистрируем
if(!file_exists("registered.trigger")){
/**
* файл registered.trigger будет создаваться после регистрации бота.
* если этого файла нет значит бот не зарегистрирован
*/
// URl текущей страницы
$page_url = "https://service.vot.by/telegram-helper/taxiBot/index.php";
$result = $bot->setWebhook($page_url);
if($result){
file_put_contents("registered.trigger",time()); // создаем файл дабы прекратить повторные регистрации
}
}
// обязательное. Запуск бота
$bot->command('start', function ($message) use ($bot) {
$answer = 'Добро пожаловать!';
$bot->sendMessage($message->getChat()->getId(), $answer);
});
// помощь
$bot->command('help', function ($message) use ($bot) {
$answer = 'Команды:
/help - помощь';
$bot->sendMessage($message->getChat()->getId(), $answer);
});
// start taxi
$bot->command('run', function ($message) use ($bot) {
$bot->sendMessage($message->getChat()->getId(), 'Для начала укажите начальную позицию поездки. Для этого введите команду /getMyPosition или /getPosition');
});
//getMyPosition
$bot->command('getMyPosition', function ($message) use ($bot) {
$bot->sendMessage($message->getChat()->getId(),"Ваше местоположение:". $latitude);
});
$bot->on(function($Update) use ($bot){
$message = $Update->getMessage();
$mtext = $message->getText();
$cid = $message->getChat()->getId();
if(mb_stripos($mtext,"власть советам") !== false){
$bot->sendMessage($message->getChat()->getId(), "Смерть богатым!");
}
}, function($message) use ($name){
return true; // когда тут true - команда проходит
});
// запускаем обработку
$bot->run();
{
"name": "root/taxi-bot",
"description": "MrCab Bot",
"license": "MIT",
"authors": [
{
"name": "SmileyThane",
"email": "thane.crios@gmail.com"
}
],
"require": {
"telegram-bot/api": "*"
}
}
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "cba03d98d4c4dee89c332e67eda4b87b",
"content-hash": "4c6f38984b8356bf8c2a7621a410d294",
"packages": [
{
"name": "telegram-bot/api",
"version": "v2.3.7",
"source": {
"type": "git",
"url": "https://github.com/TelegramBot/Api.git",
"reference": "6140a2350ca0a0be0489dcf933a903272d517f98"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/TelegramBot/Api/zipball/6140a2350ca0a0be0489dcf933a903272d517f98",
"reference": "6140a2350ca0a0be0489dcf933a903272d517f98",
"shasum": ""
},
"require": {
"php": ">=5.5.0"
},
"require-dev": {
"codeception/codeception": "*",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "2.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"TelegramBot\\Api\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ilya Gusev",
"email": "mail@igusev.ru",
"homepage": "https://php-cat.com",
"role": "Developer"
}
],
"description": "PHP Wrapper for Telegram Bot API",
"homepage": "https://github.com/TelegramBot/Api",
"keywords": [
"bot",
"bot api",
"php",
"telegram"
],
"time": "2017-11-09 10:11:16"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}
<?php
header('Content-Type: text/html; charset=utf-8');
// подрубаем API
require_once("vendor/autoload.php");
//require_once("src/autoload.php");
include 'src/config.php';
include 'src/states.php';
// дебаг
if (true) {
error_reporting(E_ALL & ~(E_NOTICE | E_USER_NOTICE | E_DEPRECATED));
ini_set('display_errors', 1);
}
$token = Config::SetToken();
$bot = new \TelegramBot\Api\Client($token, null);
if (!file_exists("registered.trigger")) {
$page_url = "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
$result = $bot->setWebhook($page_url);
if ($result) {
file_put_contents("registered.trigger", time()); // создаем файл дабы прекратить повторные регистрации
} else
die("ошибка регистрации");
}
States::StartState($bot);
Commands::CatchAllMessages($bot);
$bot->run();
1511091669
\ No newline at end of file
<?php
include "config.php";
include "states.php";
include "commands.php";
\ No newline at end of file
<?php
class Commands {
public function testBot($bot) {
$bot->command('testBot', function ($message) use ($bot) {
$bot->sendMessage($message->getChat()->getId(), 'You awersome!');
});
}
public function StartBot($bot) {
$bot->command('start', function ($message) use ($bot) {
$answer = 'Добро пожаловать!';
$bot->sendMessage($message->getChat()->getId(), $answer);
$db = 'db_taxi_bot_test';
$user = 'user';
$pass = 'admin';
$cn = new PDO('mysql:host=45.55.69.246;dbname=' . $db, $user, $pass);
States::MainState($bot, $message, $cn);
});
}
public function Help($bot) {
$bot->command('help', function ($message) use ($bot) {
$answer = 'Команды:
/help - помощь';
$bot->sendMessage($message->getChat()->getId(), $answer);
});
}
// передаем картинку
public function SendPhoto($bot, $picUrl) {
$bot->command('getpic', function ($message) use ($bot) {
$bot->sendPhoto($message->getChat()->getId(), $picUrl);
});
}
// передаем документ
public function SendDocument($bot, $document) {
$bot->command('getdoc', function ($message) use ($bot) {
$bot->sendDocument($message->getChat()->getId(), $document);
});
}
public function CatchAllMessages($bot) {
// Отлов любых сообщений + обрабтка reply-кнопок
$bot->on(function($Update) use ($bot) {
$message = $Update->getMessage();
$mtext = $message->getText();
$cid = $message->getChat()->getId();
$db = 'db_taxi_bot_test';
$db2 = 'mr_cab_db';
$user = 'user';
$pass = 'admin';
$cn = new PDO('mysql:host=45.55.69.246;dbname=' . $db, $user, $pass);
$cn2 = new PDO('mysql:host=45.55.69.246;dbname=' . $db2, $user, $pass);
$cn->exec('set names utf8');
if (mb_stristr($mtext, "Добавить телефон") !== false) {
$bot->sendMessage($message->getChat()->getId(), "Введите телефон в формате: +ХХХХХХХХХХХХ ");
}
if (substr($mtext, 0, 1) == "+") {
$phoneToRegEx = intval(substr($mtext, 1));
if (is_int($phoneToRegEx)) {
States::AddPhone($bot, $message, $phoneToRegEx, $cn);
} else {
$bot->sendMessage($message->getChat()->getId(), "Это не телефон");
}
}
if ($message->getLocation() != null) {
$stmt = $cn->prepare("Select * from orders where chat_id = " . $message->getChat()->getId() . " limit 1");
$stmt->execute();
$answer = $stmt->fetch();
if ($answer != null) {
$createOrderFlag = $answer["create_order_status"];
} else {
$createOrderFlag = 0;
}
if ($createOrderFlag == 0) {
$latStart = $message->getLocation()->getLatitude();
$lngStart = $message->getLocation()->getLongitude();
$createOrderFlag = States::AddFirstPlace($bot, $message, $cn, $latStart, $lngStart);
} else if ($createOrderFlag == 1) {
$latEnd = $message->getLocation()->getLatitude();
$lngEnd = $message->getLocation()->getLongitude();
$createOrderFlag = States::AddSecondPlace($bot, $message, $cn, $latEnd, $lngEnd);
States::ConfirmPlaces($bot, $message, $cn2, $cn);
States::OrderStatus($bot, $message, $cn2, $cn);
}
}
/*if (mb_stristr($mtext, "лок") !== false) {
$bot->editMessageLiveLocation($message->getChat()->getId(), 3085, 3085, '53.690668699999996', '23.8576439');
}
*/
if (mb_stristr($mtext, "Сделать заказ") !== false) {
$getPhoneQuery = $cn->prepare("Select * from users where telegram_id = " . $cid . " limit 1");
$getPhoneQuery->execute();
$answer2 = $getPhoneQuery->fetch();
if ($answer2 == null) {
$bot->sendMessage($message->getChat()->getId(), "Добавьте, пожалуйста, свой телефон командой myphone [номер телефона]");
} else {
$createOrderFlag = States::CreateOrderState($bot, $message);
}
}
if (mb_stristr($mtext, "Подтвердить заказ") !== false) {
States::ConfirmPlaces($bot, $message, $cn2, $cn);
States::OrderStatus($bot, $message, $cn2, $cn);
}
if (mb_stristr($mtext, "История") !== false) {
States::HistoryState($bot, $message);
}
if (mb_stristr($mtext, "Статус заказа") !== false) {
States::OrderStatus($bot, $message, $cn2, $cn);
}
if (mb_stristr($mtext, "В главное меню") !== false) {
States::MainState($bot, $message, $cn);
}
if (mb_stristr($mtext, "Отменить заказ") !== false) {
States::CloseOrder($bot, $message, $cn);
}
}, function($message) use ($name) {
return true;
});
}
}
<?php
class Config {
public function SetToken() {
return $token = "477050426:AAHJxiyYC5gmZTEIuzRH8i12BKb32vYLq8I";
}
public function ConnectToDb() {
try {
$db = 'db_taxi_bot_test';
$user = 'user';
$pass = 'admin';
$cn = new PDO('mysql:host=45.55.69.246;dbname=' . $db, $user, $pass);
$cn->exec('set names utf8');
} catch (PDOException $e) {
}
return $cn;
}
}
<?php
class OrderStates {
public function FindDriverState($bot) {
}
public function NoDriverState($bot) {
}
public function DriverArrivedState($bot) {
}
public function StartJourneyState($bot) {
}
public function EndJourneyState($bot) {
}
public function PaidState($bot) {
}
}
This diff is collapsed. Click to expand it.
<?php
/* $dbms = 'mysql';
$host = '45.55.69.246';
$db = 'db_taxi_bot_test';
$user = 'user';
$pass = 'admin';
$dsn = "$dbms:host=$host;dbname=$db";
$cn = new PDO($dsn, $user, $pass);
$stmt = $cn->prepare("INSERT INTO orders (chat_id, start_lat, start_lng, create_order_status ) VALUES ('1', '1', '1', 1) ");
$stmt->execute();
$ch = curl_init('https://services.vot.by/oauth/token');
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'client_id:3',
'response_type:code'
));
$result = curl_exec($ch);
curl_close($ch);
//echo $result; */
/*
$ch = curl_init('https://services.vot.by/api/order/create');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjNiZDI0MTE4Y2NiZGRhODBmYjk4YzcxZmRkODA1OTYwYmQzZTZiZDUyMGU4MTcwOGYzNDMyZmY0NzI2NjdlZTkyNTdjZDU5ZDY2NjgwZjE2In0.eyJhdWQiOiIyIiwianRpIjoiM2JkMjQxMThjY2JkZGE4MGZiOThjNzFmZGQ4MDU5NjBiZDNlNmJkNTIwZTgxNzA4ZjM0MzJmZjQ3MjY2N2VlOTI1N2NkNTlkNjY2ODBmMTYiLCJpYXQiOjE1MTE5NjUzMjksIm5iZiI6MTUxMTk2NTMyOSwiZXhwIjoxNTEzMjYxMzI5LCJzdWIiOiI1Iiwic2NvcGVzIjpbXX0.rvjHOAefy9HEEwxwEO6Q0UCXpoW9g2XcDhmeBxqn8m_2pLUyPHRPGzn4RUh-Fv8c_EQ5-CDdqrmgEbH0y1NC9D3YRPJdaKHV6EYjQz-Um37f-tOx_OqucJgusyTm8Olrjh7E5-WDeoG8E02sfqAIiCwA92w_ubXsFYB16XzVaZ5y6RnYrrc_aqvo_vk2O-1dVbtKcd8VeUogGjNAXd3dmqbwxzi96JdIsi3Z01IZGWeWmBF4BGeOoMe0CFqkcxIbkiJzYOemSbqqN5wR0vq6Y7egCddwMm8RRJIqTS54CPwcKJNVyNuifDyZ7D7eL9c9yGVX9xju_sRgq6JqM6awl1x3_TbOalyU5mSgNzjQLFV5BC-5IeT9uHMuW9DwiIddj2zRkhMg81kkoSEv90HUGmvdE5v9ascarSqCHwhrQVf-Y2HUeXG1naivXCEIdBLI0VDMweba13P2Xr_NbrQj7Xf05AevnVbg3vt_Dzwb-rcCa3tMaD_WTR3f4u7mO3j9eiyRPx7QmPY_-w3eTJopQRh31fyaZi0lTu2jgRLvKs7UG5F4McYgp0FrzezTErBM8C2ao5DgGKjs52HHs83cKTY_bnorCZI227TrA63M-fuX0M5ymL4JNzOPiWcOLagiv5oU5lFqATFqat7aOyl7gSXMm1_EBQiDYtu31Ti4VJo'
));
curl_setopt($ch, CURLOPT_POSTFIELDS, ""
. "startLatitude=123&"
. "startLongitude=345&"
. "endLatitude=2342&"
. "endLongitude=1231");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
$arr = json_decode($result, true);
if ($arr["status"] == "ok"){
echo $arr["status"]." Заказ:".$arr["order"]["id"]." оформлен. В течении 30 секунд ваш заказ будет выбран ближайшим водителем.";
}
$ch = curl_init('https://services.vot.by/api/order/403/status');
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjNiZDI0MTE4Y2NiZGRhODBmYjk4YzcxZmRkODA1OTYwYmQzZTZiZDUyMGU4MTcwOGYzNDMyZmY0NzI2NjdlZTkyNTdjZDU5ZDY2NjgwZjE2In0.eyJhdWQiOiIyIiwianRpIjoiM2JkMjQxMThjY2JkZGE4MGZiOThjNzFmZGQ4MDU5NjBiZDNlNmJkNTIwZTgxNzA4ZjM0MzJmZjQ3MjY2N2VlOTI1N2NkNTlkNjY2ODBmMTYiLCJpYXQiOjE1MTE5NjUzMjksIm5iZiI6MTUxMTk2NTMyOSwiZXhwIjoxNTEzMjYxMzI5LCJzdWIiOiI1Iiwic2NvcGVzIjpbXX0.rvjHOAefy9HEEwxwEO6Q0UCXpoW9g2XcDhmeBxqn8m_2pLUyPHRPGzn4RUh-Fv8c_EQ5-CDdqrmgEbH0y1NC9D3YRPJdaKHV6EYjQz-Um37f-tOx_OqucJgusyTm8Olrjh7E5-WDeoG8E02sfqAIiCwA92w_ubXsFYB16XzVaZ5y6RnYrrc_aqvo_vk2O-1dVbtKcd8VeUogGjNAXd3dmqbwxzi96JdIsi3Z01IZGWeWmBF4BGeOoMe0CFqkcxIbkiJzYOemSbqqN5wR0vq6Y7egCddwMm8RRJIqTS54CPwcKJNVyNuifDyZ7D7eL9c9yGVX9xju_sRgq6JqM6awl1x3_TbOalyU5mSgNzjQLFV5BC-5IeT9uHMuW9DwiIddj2zRkhMg81kkoSEv90HUGmvdE5v9ascarSqCHwhrQVf-Y2HUeXG1naivXCEIdBLI0VDMweba13P2Xr_NbrQj7Xf05AevnVbg3vt_Dzwb-rcCa3tMaD_WTR3f4u7mO3j9eiyRPx7QmPY_-w3eTJopQRh31fyaZi0lTu2jgRLvKs7UG5F4McYgp0FrzezTErBM8C2ao5DgGKjs52HHs83cKTY_bnorCZI227TrA63M-fuX0M5ymL4JNzOPiWcOLagiv5oU5lFqATFqat7aOyl7gSXMm1_EBQiDYtu31Ti4VJo'
));
$result = curl_exec($ch);
curl_close($ch);
$arr = json_decode($result, true);
if (mb_stristr($result, '2') != true) {
echo $arr[0] ;
} else {
echo "foo";
}*/
$ch2 = curl_init('https://services.vot.by/api/order/422/status');
curl_setopt($ch2, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImY4ZGQ1ODQwYzI0ZDQ5OGRiMGU4YTRjOTM2ZjkwNjVjOTA4ODBiOGUxYjQ4NzUwNDMwYzQ4YmZlMDUwMjRiMmQyNWUwNDQyYmRlOGMzOWJlIn0.eyJhdWQiOiIyIiwianRpIjoiZjhkZDU4NDBjMjRkNDk4ZGIwZThhNGM5MzZmOTA2NWM5MDg4MGI4ZTFiNDg3NTA0MzBjNDhiZmUwNTAyNGIyZDI1ZTA0NDJiZGU4YzM5YmUiLCJpYXQiOjE1MTI2MTI1NTcsIm5iZiI6MTUxMjYxMjU1NywiZXhwIjoxNTEzOTA4NTU3LCJzdWIiOiI1Iiwic2NvcGVzIjpbXX0.G5oWVja_ucRjQ05vam8DyxwgJbBlicLk805H1QJx9Flv2k140pujDfrZSP76meFmZBCXLLXX7MY-4XQgL4ARHNR3RVrfhFHn8mOOmSAAYbI2vWIEggedp_zzHh59LpME0Ve-H00pdW4k3at72A9Zoy2bQHxqz26i1SepAfn4lyVFejgR7pP2KCOHJ0gT89DhPdqfM_68Z7g6QnS6N3R-Kftlz9grUQGcGh0z-a8cRsBcBBzEW5pbCC2oQx4BMnsHl0JQIP2a5xKKoE5ZOjypelkTLWhnUGFQgk57fAkmmC6EY5P-amuK7nTwxCnPjrOfM9ZLUXujsGLV6RLudVlcbmfmzS4N0MsUvZrhbMz2KRocH8t5XlnW416oD7dyU_NXRBNh3JGB-_dawaVtTVhgR60SFQzhn34w2thx_Ti8ULxFGodRv3WH1rdR45c8X2pT2jaZxa_J2KAD53mtDShBG59GVdsGxNB5BItuwmhMWX_1dvEYGtysgA-kTfMNefEKXBBM6Px00a0A-vU3pXVbBrlZ-l-bvHiSI93QzmcjrSf7UGagrkixUvu6JecH8EDaDCFzvjR34EVty_KgGaIf_D--TwI5gaimgFtgFklHRDd_A50dSvDprW0QqXGoEfx9BiRhnVNxrm2jfs7_Ea86RjBfFpnL38exxBd2gnqpIqg'
));
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1);
$sResult = curl_exec($ch2);
curl_close($ch2);
$arr_status = json_decode($sResult, true);
//echo $arr_status['name'];
echo $arr_status['id'];
\ No newline at end of file
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit3477a84503f435a6560297d873c168ff::getLoader();
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'TelegramBot\\Api\\' => array($vendorDir . '/telegram-bot/api/src'),
);
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit3477a84503f435a6560297d873c168ff
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit3477a84503f435a6560297d873c168ff', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit3477a84503f435a6560297d873c168ff', 'loadClassLoader'));
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register(true);
return $loader;
}
}
[
{
"name": "telegram-bot/api",
"version": "v2.3.7",
"version_normalized": "2.3.7.0",
"source": {
"type": "git",
"url": "https://github.com/TelegramBot/Api.git",
"reference": "6140a2350ca0a0be0489dcf933a903272d517f98"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/TelegramBot/Api/zipball/6140a2350ca0a0be0489dcf933a903272d517f98",
"reference": "6140a2350ca0a0be0489dcf933a903272d517f98",
"shasum": ""
},
"require": {
"php": ">=5.5.0"
},
"require-dev": {
"codeception/codeception": "*",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "2.*"
},
"time": "2017-11-09 10:11:16",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"TelegramBot\\Api\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ilya Gusev",
"email": "mail@igusev.ru",
"homepage": "https://php-cat.com",
"role": "Developer"
}
],
"description": "PHP Wrapper for Telegram Bot API",
"homepage": "https://github.com/TelegramBot/Api",
"keywords": [
"bot",
"bot api",
"php",
"telegram"
]
}
]
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org
root = true
[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
# Changelog
All Notable changes to `PHP Telegram Bot Api` will be documented in this file
## NEXT - YYYY-MM-DD
### Added
- Nothing
### Deprecated
- Nothing
### Fixed
- Nothing
### Removed
- Nothing
### Security
- Nothing
# Contributing
Contributions are **welcome** and will be fully **credited**.
We accept contributions via Pull Requests on [Github](https://github.com/tgbot/api).
## Pull Requests
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
- **Create feature branches** - Don't ask us to pull from your master branch.
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
## Running Tests
``` bash
$ phpunit
```
**Happy coding**!
# The MIT License (MIT)
Copyright (c) 2015 Ilya Gusev <mail@igusev.ru>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
# PHP Telegram Bot Api
[![Latest Version on Packagist](https://img.shields.io/packagist/v/telegram-bot/api.svg?style=flat-square)](https://packagist.org/packages/telegram-bot/api)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Build Status](https://img.shields.io/travis/TelegramBot/Api/master.svg?style=flat-square)](https://travis-ci.org/TelegramBot/Api)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/telegrambot/api.svg?style=flat-square)](https://scrutinizer-ci.com/g/telegrambot/api/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/g/telegrambot/api.svg?style=flat-square)](https://scrutinizer-ci.com/g/telegrambot/api)
[![Total Downloads](https://img.shields.io/packagist/dt/telegram-bot/api.svg?style=flat-square)](https://packagist.org/packages/telegram-bot/api)
An extended native php wrapper for [Telegram Bot API](https://core.telegram.org/bots/api) without requirements. Supports all methods and types of responses.
## Bots: An introduction for developers
>Bots are special Telegram accounts designed to handle messages automatically. Users can interact with bots by sending them command messages in private or group chats.
>You control your bots using HTTPS requests to [bot API](https://core.telegram.org/bots/api).
>The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.
To learn how to create and set up a bot, please consult [Introduction to Bots](https://core.telegram.org/bots) and [Bot FAQ](https://core.telegram.org/bots/faq).
## Install
Via Composer
``` bash
$ composer require telegram-bot/api
```
## Usage
See example [DevAnswerBot](https://github.com/TelegramBot/DevAnswerBot) (russian).
#### API Wrapper
``` php
$bot = new \TelegramBot\Api\BotApi('YOUR_BOT_API_TOKEN');
$bot->sendMessage($chatId, $messageText);
```
```php
$bot = new \TelegramBot\Api\BotApi('YOUR_BOT_API_TOKEN');
$document = new \CURLFile('document.txt');
$bot->sendDocument($chatId, $document);
```
```php
$bot = new \TelegramBot\Api\BotApi('YOUR_BOT_API_TOKEN');
$keyboard = new \TelegramBot\Api\Types\ReplyKeyboardMarkup(array(array("one", "two", "three")), true); // true for one-time keyboard
$bot->sendMessage($chatId, $messageText, null, false, null, $keyboard);
```
```php
$bot = new \TelegramBot\Api\BotApi('YOUR_BOT_API_TOKEN');
$keyboard = new \TelegramBot\Api\Types\Inline\InlineKeyboardMarkup(
[
[
['text' => 'link', 'url' => 'https://core.telegram.org']
]
]
);
$bot->sendMessage($chatId, $messageText, null, false, null, $keyboard);
```
#### Client
```php
require_once "vendor/autoload.php";
try {
$bot = new \TelegramBot\Api\Client('YOUR_BOT_API_TOKEN');
// or initialize with botan.io tracker api key
// $bot = new \TelegramBot\Api\Client('YOUR_BOT_API_TOKEN', 'YOUR_BOTAN_TRACKER_API_KEY');
$bot->command('ping', function ($message) use ($bot) {
$bot->sendMessage($message->getChat()->getId(), 'pong!');
});
$bot->run();
} catch (\TelegramBot\Api\Exception $e) {
$e->getMessage();
}
```
### Botan SDK
[Botan](http://botan.io) is a telegram bot analytics system based on [Yandex.Appmetrica](http://appmetrica.yandex.com/).
In this document you can find how to setup Yandex.Appmetrica account, as well as examples of Botan SDK usage.
### Creating an account
* Register at http://appmetrica.yandex.com/
* After registration you will be prompted to create Application. Please use @YourBotName as a name.
* Save an API key from settings page, you will use it as a token for Botan API calls.
* Download lib for your language, and use it as described below. Don`t forget to insert your token!
Since we are only getting started, you may discover that some existing reports in AppMetriсa aren't properly working for Telegram bots, like Geography, Gender, Age, Library, Devices, Traffic sources and Network sections. We will polish that later.
## SDK usage
#### Standalone
```php
$tracker = new \TelegramBot\Api\Botan('YOUR_BOTAN_TRACKER_API_KEY');
$tracker->track($message, $eventName);
```
#### API Wrapper
```php
$bot = new \TelegramBot\Api\BotApi('YOUR_BOT_API_TOKEN', 'YOUR_BOTAN_TRACKER_API_KEY');
$bot->track($message, $eventName);
```
_You can use method `getUpdates()` and all incoming messages will be automatically tracked as `Message`-event_
#### Client
```php
$bot = new \TelegramBot\Api\Client('YOUR_BOT_API_TOKEN', 'YOUR_BOTAN_TRACKER_API_KEY');
```
_All registered commands are automatically tracked as command name_
## Change log
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Testing
``` bash
$ composer test
```
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security
If you discover any security related issues, please email mail@igusev.ru instead of using the issue tracker.
## Credits
- [Ilya Gusev](https://github.com/iGusev)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
{
"name": "telegram-bot/api",
"description": "PHP Wrapper for Telegram Bot API",
"keywords": [
"php",
"telegram",
"bot",
"bot api"
],
"homepage": "https://github.com/TelegramBot/Api",
"license": "MIT",
"authors": [
{
"name": "Ilya Gusev",
"email": "mail@igusev.ru",
"homepage": "https://php-cat.com",
"role": "Developer"
}
],
"require": {
"php" : ">=5.5.0"
},
"require-dev": {
"phpunit/phpunit" : "~4.0",
"squizlabs/php_codesniffer": "2.*",
"codeception/codeception": "*"
},
"autoload": {
"psr-4": {
"TelegramBot\\Api\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"TelegramBot\\Api\\Test\\": "tests"
}
},
"scripts": {
"test": "phpunit"
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
}
}
<?php
namespace TelegramBot\Api;
/**
* Class BadMethodCallException
*
* @codeCoverageIgnore
* @package TelegramBot\Api
*/
class BadMethodCallException extends Exception
{
}
<?php
namespace TelegramBot\Api;
/**
* Class BaseType
* Base class for Telegram Types
*
* @package TelegramBot\Api
*/
abstract class BaseType
{
/**
* Array of required data params for type
*
* @var array
*/
protected static $requiredParams = [];
/**
* Map of input data
*
* @var array
*/
protected static $map = [];
/**
* Validate input data
*
* @param array $data
*
* @return bool
*
* @throws InvalidArgumentException
*/
public static function validate($data)
{
if (count(array_intersect_key(array_flip(static::$requiredParams), $data)) === count(static::$requiredParams)) {
return true;
}
throw new InvalidArgumentException();
}
public function map($data)
{
foreach (static::$map as $key => $item) {
if (isset($data[$key]) && (!is_array($data[$key]) || (is_array($data[$key]) && !empty($data[$key])))) {
$method = 'set' . self::toCamelCase($key);
if ($item === true) {
$this->$method($data[$key]);
} else {
$this->$method($item::fromResponse($data[$key]));
}
}
}
}
protected static function toCamelCase($str)
{
return str_replace(" ", "", ucwords(str_replace("_", " ", $str)));
}
public function toJson($inner = false)
{
$output = [];
foreach (static::$map as $key => $item) {
$property = lcfirst(self::toCamelCase($key));
if (!is_null($this->$property)) {
if (is_array($this->$property)) {
$output[$key] = array_map(
function ($v) {
return is_object($v) ? $v->toJson(true) : $v;
},
$this->$property
);
} else {
$output[$key] = $item === true ? $this->$property : $this->$property->toJson(true);
}
}
}
return $inner === false ? json_encode($output) : $output;
}
public static function fromResponse($data)
{
if ($data === true) {
return true;
}
self::validate($data);
$instance = new static();
$instance->map($data);
return $instance;
}
}
<?php
namespace TelegramBot\Api;
use TelegramBot\Api\Types\Message;
class Botan
{
/**
* @var string Tracker url
*/
const BASE_URL = 'https://api.botan.io/track';
/**
* CURL object
*
* @var
*/
protected $curl;
/**
* Yandex AppMetrica application api_key
*
* @var string
*/
protected $token;
/**
* Botan constructor
*
* @param string $token
*
* @throws \Exception
*/
public function __construct($token)
{
if (!function_exists('curl_version')) {
throw new Exception('CURL not installed');
}
if (empty($token) || !is_string($token)) {
throw new InvalidArgumentException('Token should be a string');
}
$this->token = $token;
$this->curl = curl_init();
}
/**
* Event tracking
*
* @param \TelegramBot\Api\Types\Message $message
* @param string $eventName
*
* @throws \TelegramBot\Api\Exception
* @throws \TelegramBot\Api\HttpException
*/
public function track(Message $message, $eventName = 'Message')
{
$uid = $message->getFrom()->getId();
$options = [
CURLOPT_URL => self::BASE_URL . "?token={$this->token}&uid={$uid}&name={$eventName}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => $message->toJson()
];
curl_setopt_array($this->curl, $options);
$result = BotApi::jsonValidate(curl_exec($this->curl), true);
BotApi::curlValidate($this->curl);
if ($result['status'] !== 'accepted') {
throw new Exception('Error Processing Request');
}
}
/**
* Destructor. Close curl
*/
public function __destruct()
{
$this->curl && curl_close($this->curl);
}
}
<?php
namespace TelegramBot\Api\Events;
use TelegramBot\Api\Types\Message;
use TelegramBot\Api\Types\Update;
class Event
{
/**
* @var \Closure
*/
protected $checker;
/**
* @var \Closure
*/
protected $action;
/**
* Event constructor.
*
* @param \Closure $action
* @param \Closure|null $checker
*/
public function __construct(\Closure $action, \Closure $checker)
{
$this->action = $action;
$this->checker = $checker;
}
/**
* @return \Closure
*/
public function getAction()
{
return $this->action;
}
/**
* @return \Closure|null
*/
public function getChecker()
{
return $this->checker;
}
/**
* @param \TelegramBot\Api\Types\Update
*
* @return mixed
*/
public function executeChecker(Update $message)
{
if (is_callable($this->checker)) {
return call_user_func($this->checker, $message);
}
return false;
}
/**
* @param \TelegramBot\Api\Types\Update
*
* @return mixed
*/
public function executeAction(Update $message)
{
if (is_callable($this->action)) {
return call_user_func($this->action, $message);
}
return false;
}
}
<?php
namespace TelegramBot\Api\Events;
use Closure;
use ReflectionFunction;
use TelegramBot\Api\Botan;
use TelegramBot\Api\Types\Update;
class EventCollection
{
/**
* Array of events.
*
* @var array
*/
protected $events;
/**
* Botan tracker
*
* @var \TelegramBot\Api\Botan
*/
protected $tracker;
/**
* EventCollection constructor.
*
* @param string $trackerToken
*/
public function __construct($trackerToken = null)
{
if ($trackerToken) {
$this->tracker = new Botan($trackerToken);
}
}
/**
* Add new event to collection
*
* @param Closure $event
* @param Closure|null $checker
*
* @return \TelegramBot\Api\Events\EventCollection
*/
public function add(Closure $event, $checker = null)
{
$this->events[] = !is_null($checker) ? new Event($event, $checker)
: new Event($event, function () {
});
return $this;
}
/**
* @param \TelegramBot\Api\Types\Update
*/
public function handle(Update $update)
{
foreach ($this->events as $event) {
/* @var \TelegramBot\Api\Events\Event $event */
if ($event->executeChecker($update) === true) {
if (false === $event->executeAction($update)) {
if (!is_null($this->tracker)) {
$checker = new ReflectionFunction($event->getChecker());
$this->tracker->track($update->getMessage(), $checker->getStaticVariables()['name']);
}
break;
}
}
}
}
}
<?php
namespace TelegramBot\Api;
/**
* Class Exception
*
* @codeCoverageIgnore
* @package TelegramBot\Api
*/
class Exception extends \Exception
{
}
<?php
namespace TelegramBot\Api;
/**
* Class HttpException
*
* @codeCoverageIgnore
* @package TelegramBot\Api
*/
class HttpException extends Exception
{
/**
* @var array
*/
protected $parameters = [];
/**
* HttpException constructor.
*
* @param string $message [optional] The Exception message to throw.
* @param int $code [optional] The Exception code.
* @param Exception $previous [optional] The previous throwable used for the exception chaining.
* @param array $parameters [optional] Array of parameters returned from API.
*/
public function __construct($message = '', $code = 0, Exception $previous = null, $parameters = [])
{
$this->parameters = $parameters;
parent::__construct($message, $code, $previous);
}
/**
* @return array
*/
public function getParameters()
{
return $this->parameters;
}
}
<?php
namespace TelegramBot\Api;
/**
* Class InvalidArgumentException
*
* @codeCoverageIgnore
* @package TelegramBot\Api
*/
class InvalidArgumentException extends Exception
{
}
<?php
namespace TelegramBot\Api;
/**
* Class InvalidJsonException
*
* @codeCoverageIgnore
* @package TelegramBot\Api
*/
class InvalidJsonException extends Exception
{
}
<?php
namespace TelegramBot\Api;
interface TypeInterface
{
public static function fromResponse($data);
}
<?php
namespace TelegramBot\Api\Types;
abstract class ArrayOfArrayOfPhotoSize
{
public static function fromResponse($data)
{
return array_map(function ($arrayOfPhotoSize) {
return ArrayOfPhotoSize::fromResponse($arrayOfPhotoSize);
}, $data);
}
}
<?php
namespace TelegramBot\Api\Types;
abstract class ArrayOfChatMemberEntity
{
public static function fromResponse($data)
{
$arrayOfChatMemberEntity = [];
foreach ($data as $chatMemberEntity) {
$arrayOfChatMemberEntity[] = ChatMember::fromResponse($chatMemberEntity);
}
return $arrayOfChatMemberEntity;
}
}
<?php
/**
* Created by PhpStorm.
* User: iGusev
* Date: 13/04/16
* Time: 04:16
*/
namespace TelegramBot\Api\Types;
abstract class ArrayOfMessageEntity
{
public static function fromResponse($data)
{
$arrayOfMessageEntity = [];
foreach ($data as $messageEntity) {
$arrayOfMessageEntity[] = MessageEntity::fromResponse($messageEntity);
}
return $arrayOfMessageEntity;
}
}
<?php
namespace TelegramBot\Api\Types;
abstract class ArrayOfPhotoSize
{
public static function fromResponse($data)
{
$arrayOfPhotoSize = [];
foreach ($data as $photoSizeItem) {
$arrayOfPhotoSize[] = PhotoSize::fromResponse($photoSizeItem);
}
return $arrayOfPhotoSize;
}
}
<?php
namespace TelegramBot\Api\Types;
abstract class ArrayOfUpdates
{
public static function fromResponse($data)
{
$arrayOfUpdates = [];
foreach ($data as $update) {
$arrayOfUpdates[] = Update::fromResponse($update);
}
return $arrayOfUpdates;
}
}
<?php
namespace TelegramBot\Api\Types;
use TelegramBot\Api\BaseType;
use TelegramBot\Api\InvalidArgumentException;
use TelegramBot\Api\TypeInterface;
/**
* Class Audio
* This object represents an audio file (voice note).
*
* @package TelegramBot\Api\Types
*/
class Audio extends BaseType implements TypeInterface
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['file_id', 'duration'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'file_id' => true,
'duration' => true,
'performer' => true,
'title' => true,
'mime_type' => true,
'file_size' => true
];
/**
* Unique identifier for this file
*
* @var string
*/
protected $fileId;
/**
* Photo width
*
* @var int
*/
protected $duration;
/**
* Optional. Performer of the audio as defined by sender or by audio tags
*
* @var string
*/
protected $performer;
/**
* Optional. Title of the audio as defined by sender or by audio tags
*
* @var string
*/
protected $title;
/**
* Optional. MIME type of the file as defined by sender
*
* @var string
*/
protected $mimeType;
/**
* Optional. File size
*
* @var int
*/
protected $fileSize;
/**
* @return int
*/
public function getDuration()
{
return $this->duration;
}
/**
* @param int $duration
*
* @throws InvalidArgumentException
*/
public function setDuration($duration)
{
if (is_integer($duration)) {
$this->duration = $duration;
} else {
throw new InvalidArgumentException();
}
}
/**
* @return string
*/
public function getPerformer()
{
return $this->performer;
}
/**
* @param string $performer
*/
public function setPerformer($performer)
{
$this->performer = $performer;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @param string $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* @return string
*/
public function getFileId()
{
return $this->fileId;
}
/**
* @param string $fileId
*/
public function setFileId($fileId)
{
$this->fileId = $fileId;
}
/**
* @return int
*/
public function getFileSize()
{
return $this->fileSize;
}
/**
* @param int $fileSize
*
* @throws InvalidArgumentException
*/
public function setFileSize($fileSize)
{
if (is_integer($fileSize)) {
$this->fileSize = $fileSize;
} else {
throw new InvalidArgumentException();
}
}
/**
* @return string
*/
public function getMimeType()
{
return $this->mimeType;
}
/**
* @param string $mimeType
*/
public function setMimeType($mimeType)
{
$this->mimeType = $mimeType;
}
}
<?php
namespace TelegramBot\Api\Types;
use TelegramBot\Api\BaseType;
/**
* Class CallbackQuery
* This object represents an incoming callback query from a callback
* button in an inline keyboard.
* If the button that originated the query was attached to a message sent by the bot,
* the field message will be present.
* If the button was attached to a message sent via the bot (in inline mode),
* the field inline_message_id will be present.
* Exactly one of the fields data or game_short_name will be present.
*
* @package TelegramBot\Api\Types
*/
class CallbackQuery extends BaseType
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['id', 'from'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'id' => true,
'from' => User::class,
'message' => Message::class,
'inline_message_id' => true,
'chat_instance' => true,
'data' => true,
'game_short_name' => true
];
/**
* Unique identifier for this query
*
* @var string
*/
protected $id;
/**
* Sender
*
* @var \TelegramBot\Api\Types\User
*/
protected $from;
/**
* Optional. Message with the callback button that originated the query.
* Note that message content and message date will not be available
* if the message is too old
*
* @var \TelegramBot\Api\Types\Message
*/
protected $message;
/**
* Optional. Identifier of the message sent via the bot in inline mode,
* that originated the query.
*
* @var string
*/
protected $inlineMessageId;
/**
* Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent.
* Useful for high scores in games.
*
* @var string
*/
protected $chatInstance;
/**
* Optional. Data associated with the callback button.
* Be aware that a bad client can send arbitrary data in this field.
*
* @var string
*/
protected $data;
/**
* Optional. Short name of a Game to be returned,
* serves as the unique identifier for the game
*
* @var string
*/
protected $gameShortName;
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* @param string $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return User
*/
public function getFrom()
{
return $this->from;
}
/**
* @param User $from
*/
public function setFrom(User $from)
{
$this->from = $from;
}
/**
* @return Message
*/
public function getMessage()
{
return $this->message;
}
/**
* @param Message $message
*/
public function setMessage($message)
{
$this->message = $message;
}
/**
* @return string
*/
public function getInlineMessageId()
{
return $this->inlineMessageId;
}
/**
* @param string $inlineMessageId
*/
public function setInlineMessageId($inlineMessageId)
{
$this->inlineMessageId = $inlineMessageId;
}
/**
* @return string
*/
public function getChatInstance()
{
return $this->chatInstance;
}
/**
* @param string $chatInstance
*/
public function setChatInstance($chatInstance)
{
$this->chatInstance = $chatInstance;
}
/**
* @return string
*/
public function getData()
{
return $this->data;
}
/**
* @param string $data
*/
public function setData($data)
{
$this->data = $data;
}
/**
* @return string
*/
public function getGameShortName()
{
return $this->gameShortName;
}
/**
* @param string $gameShortName
*/
public function setGameShortName($gameShortName)
{
$this->gameShortName = $gameShortName;
}
}
<?php
namespace TelegramBot\Api\Types;
use TelegramBot\Api\BaseType;
use TelegramBot\Api\InvalidArgumentException;
use TelegramBot\Api\TypeInterface;
class Chat extends BaseType implements TypeInterface
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['id', 'type'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'id' => true,
'type' => true,
'title' => true,
'username' => true,
'first_name' => true,
'last_name' => true,
'all_members_are_administrators' => true,
'photo' => ChatPhoto::class,
'description' => true,
'invite_link' => true,
'pinned_message' => Message::class,
'sticker_set_name' => true,
'can_set_sticker_set' => true
];
/**
* Unique identifier for this chat, not exceeding 1e13 by absolute value
*
* @var int|string
*/
protected $id;
/**
* Type of chat, can be either “private”, “group”, “supergroup” or “channel”
*
* @var string
*/
protected $type;
/**
* Optional. Title, for channels and group chats
*
* @var string
*/
protected $title;
/**
* Optional. Username, for private chats and channels if available
*
* @var string
*/
protected $username;
/**
* Optional. First name of the other party in a private chat
*
* @var string
*/
protected $firstName;
/**
* Optional. Last name of the other party in a private chat
*
* @var string
*/
protected $lastName;
protected $allMembersAreAdministrators;
/**
* Optional. Chat photo. Returned only in getChat.
*
* @var ChatPhoto
*/
protected $photo;
/**
* Optional. Description, for supergroups and channel chats. Returned only in getChat.
*
* @var string
*/
protected $description;
/**
* Optional. Chat invite link, for supergroups and channel chats. Returned only in getChat.
*
* @var string
*/
protected $inviteLink;
/**
* Optional. Pinned message, for supergroups. Returned only in getChat.
*
* @var Message
*/
protected $pinnedMessage;
/**
* Optional. For supergroups, name of group sticker set. Returned only in getChat.
*
* @var string
*/
protected $stickerSetName;
/**
* Optional. True, if the bot can change the group sticker set. Returned only in getChat.
*
* @var bool
*/
protected $canSetStickerSet;
/**
* @return int|string
*/
public function getId()
{
return $this->id;
}
/**
* @param int|string $id
*
* @throws InvalidArgumentException
*/
public function setId($id)
{
if (is_integer($id) || is_float($id) || is_string($id)) {
$this->id = $id;
} else {
throw new InvalidArgumentException();
}
}
/**
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* @param string $type
*/
public function setType($type)
{
$this->type = $type;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @param string $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* @return string
*/
public function getUsername()
{
return $this->username;
}
/**
* @param string $username
*/
public function setUsername($username)
{
$this->username = $username;
}
/**
* @return string
*/
public function getFirstName()
{
return $this->firstName;
}
/**
* @param string $firstName
*/
public function setFirstName($firstName)
{
$this->firstName = $firstName;
}
/**
* @return string
*/
public function getLastName()
{
return $this->lastName;
}
/**
* @param string $lastName
*/
public function setLastName($lastName)
{
$this->lastName = $lastName;
}
/**
* @return mixed
*/
public function getAllMembersAreAdministrators()
{
return $this->allMembersAreAdministrators;
}
/**
* @param mixed $allMembersAreAdministrators
*/
public function setAllMembersAreAdministrators($allMembersAreAdministrators)
{
$this->allMembersAreAdministrators = $allMembersAreAdministrators;
}
/**
* @return ChatPhoto
*/
public function getPhoto()
{
return $this->photo;
}
/**
* @param ChatPhoto $photo
*/
public function setPhoto($photo)
{
$this->photo = $photo;
}
/**
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* @param string $description
*/
public function setDescription($description)
{
$this->description = $description;
}
/**
* @return string
*/
public function getInviteLink()
{
return $this->inviteLink;
}
/**
* @param string $inviteLink
*/
public function setInviteLink($inviteLink)
{
$this->inviteLink = $inviteLink;
}
/**
* @return Message
*/
public function getPinnedMessage()
{
return $this->pinnedMessage;
}
/**
* @param Message $pinnedMessage
*/
public function setPinnedMessage($pinnedMessage)
{
$this->pinnedMessage = $pinnedMessage;
}
/**
* @return string
*/
public function getStickerSetName()
{
return $this->stickerSetName;
}
/**
* @param string $stickerSetName
*/
public function setStickerSetName($stickerSetName)
{
$this->stickerSetName = $stickerSetName;
}
/**
* @return bool
*/
public function isCanSetStickerSet()
{
return $this->canSetStickerSet;
}
/**
* @param bool $canSetStickerSet
*/
public function setCanSetStickerSet($canSetStickerSet)
{
$this->canSetStickerSet = $canSetStickerSet;
}
}
<?php
namespace TelegramBot\Api\Types;
use TelegramBot\Api\BaseType;
class ChatMember extends BaseType
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['user', 'status'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'user' => User::class,
'status' => true,
'until_date' => true,
'can_be_edited' => true,
'can_change_info' => true,
'can_post_messages' => true,
'can_edit_messages' => true,
'can_delete_messages' => true,
'can_invite_users' => true,
'can_restrict_members' => true,
'can_pin_messages' => true,
'can_promote_members' => true,
'can_send_messages' => true,
'can_send_media_messages' => true,
'can_send_other_messages' => true,
'can_add_web_page_previews' => true
];
/**
* Information about the user
*
* @var User
*/
protected $user;
/**
* The member's status in the chat. Can be “creator”, “administrator”, “member”, “restricted”, “left” or “kicked”
*
* @var string
*/
protected $status;
/**
* Optional. Restictred and kicked only. Date when restrictions will be lifted for this user, unix time
*
* @var integer
*/
protected $untilDate;
/**
* Optional. Administrators only. True, if the bot is allowed to edit administrator privileges of that user
*
* @var bool
*/
protected $canBeEdited;
/**
* Optional. Administrators only. True, if the administrator can change the chat title, photo and other settings
*
* @var bool
*/
protected $canChangeInfo;
/**
* Optional. Administrators only. True, if the administrator can post in the channel, channels only
*
* @var bool
*/
protected $canPostMessages;
/**
* Optional. Administrators only. True, if the administrator can edit messages of other users, channels only
*
* @var bool
*/
protected $canEditMessages;
/**
* Optional. Administrators only. True, if the administrator can delete messages of other users
*
* @var bool
*/
protected $canDeleteMessages;
/**
* Optional. Administrators only. True, if the administrator can invite new users to the chat
*
* @var bool
*/
protected $canInviteUsers;
/**
* Optional. Administrators only. True, if the administrator can restrict, ban or unban chat members
*
* @var bool
*/
protected $canRestrictMembers;
/**
* Optional. Administrators only. True, if the administrator can pin messages, supergroups only
*
* @var bool
*/
protected $canPinMessages;
/**
* Optional. Administrators only. True, if the administrator can add new administrators with a subset of his own
* privileges or demote administrators that he has promoted, directly or indirectly
* (promoted by administrators that were appointed by the user)
*
* @var bool
*/
protected $canPromoteMembers;
/**
* Optional. Restricted only. True, if the user can send text messages, contacts, locations and venues
*
* @var bool
*/
protected $canSendMessages;
/**
* Optional. Restricted only. True, if the user can send audios, documents, photos, videos, video notes
* and voice notes, implies can_send_messages
*
* @var bool
*/
protected $canSendMediaMessages;
/**
* Optional. Restricted only. True, if the user can send animations, games, stickers and use inline bots,
* implies can_send_media_messages
*
* @var bool
*/
protected $canSendOtherMessages;
/**
* Optional. Restricted only. True, if user may add web page previews to his messages,
* implies can_send_media_messages
*
* @var bool
*/
protected $canAddWebPagePreviews;
/**
* @return User
*/
public function getUser()
{
return $this->user;
}
/**
* @param User $user
*/
public function setUser($user)
{
$this->user = $user;
}
/**
* @return string
*/
public function getStatus()
{
return $this->status;
}
/**
* @param string $status
*/
public function setStatus($status)
{
$this->status = $status;
}
/**
* @return int
*/
public function getUntilDate()
{
return $this->untilDate;
}
/**
* @param int $untilDate
*/
public function setUntilDate($untilDate)
{
$this->untilDate = $untilDate;
}
/**
* @return bool
*/
public function getCanBeEdited()
{
return $this->canBeEdited;
}
/**
* @param bool $canBeEdited
*/
public function setCanBeEdited($canBeEdited)
{
$this->canBeEdited = $canBeEdited;
}
/**
* @return bool
*/
public function getCanChangeInfo()
{
return $this->canChangeInfo;
}
/**
* @param bool $canChangeInfo
*/
public function setCanChangeInfo($canChangeInfo)
{
$this->canChangeInfo = $canChangeInfo;
}
/**
* @return bool
*/
public function getCanPostMessages()
{
return $this->canPostMessages;
}
/**
* @param bool $canPostMessages
*/
public function setCanPostMessages($canPostMessages)
{
$this->canPostMessages = $canPostMessages;
}
/**
* @return bool
*/
public function getCanEditMessages()
{
return $this->canEditMessages;
}
/**
* @param bool $canEditMessages
*/
public function setCanEditMessages($canEditMessages)
{
$this->canEditMessages = $canEditMessages;
}
/**
* @return bool
*/
public function getCanDeleteMessages()
{
return $this->canDeleteMessages;
}
/**
* @param bool $canDeleteMessages
*/
public function setCanDeleteMessages($canDeleteMessages)
{
$this->canDeleteMessages = $canDeleteMessages;
}
/**
* @return bool
*/
public function getCanInviteUsers()
{
return $this->canInviteUsers;
}
/**
* @param bool $canInviteUsers
*/
public function setCanInviteUsers($canInviteUsers)
{
$this->canInviteUsers = $canInviteUsers;
}
/**
* @return bool
*/
public function getCanRestrictMembers()
{
return $this->canRestrictMembers;
}
/**
* @param bool $canRestrictMembers
*/
public function setCanRestrictMembers($canRestrictMembers)
{
$this->canRestrictMembers = $canRestrictMembers;
}
/**
* @return bool
*/
public function getCanPinMessages()
{
return $this->canPinMessages;
}
/**
* @param bool $canPinMessages
*/
public function setCanPinMessages($canPinMessages)
{
$this->canPinMessages = $canPinMessages;
}
/**
* @return bool
*/
public function getCanPromoteMembers()
{
return $this->canPromoteMembers;
}
/**
* @param bool $canPromoteMembers
*/
public function setCanPromoteMembers($canPromoteMembers)
{
$this->canPromoteMembers = $canPromoteMembers;
}
/**
* @return bool
*/
public function getCanSendMessages()
{
return $this->canSendMessages;
}
/**
* @param bool $canSendMessages
*/
public function setCanSendMessages($canSendMessages)
{
$this->canSendMessages = $canSendMessages;
}
/**
* @return bool
*/
public function getCanSendMediaMessages()
{
return $this->canSendMediaMessages;
}
/**
* @param bool $canSendMediaMessages
*/
public function setCanSendMediaMessages($canSendMediaMessages)
{
$this->canSendMediaMessages = $canSendMediaMessages;
}
/**
* @return bool
*/
public function getCanSendOtherMessages()
{
return $this->canSendOtherMessages;
}
/**
* @param bool $canSendOtherMessages
*/
public function setCanSendOtherMessages($canSendOtherMessages)
{
$this->canSendOtherMessages = $canSendOtherMessages;
}
/**
* @return bool
*/
public function getCanAddWebPagePreviews()
{
return $this->canAddWebPagePreviews;
}
/**
* @param bool $canAddWebPagePreviews
*/
public function setCanAddWebPagePreviews($canAddWebPagePreviews)
{
$this->canAddWebPagePreviews = $canAddWebPagePreviews;
}
}
<?php
namespace TelegramBot\Api\Types;
use TelegramBot\Api\BaseType;
class ChatPhoto extends BaseType
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['small_file_id', 'big_file_id'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'small_file_id' => true,
'big_file_id' => true,
];
/**
* Unique file identifier of small (160x160) chat photo. This file_id can be used only for photo download.
*
* @var string
*/
protected $smallFileId;
/**
* Unique file identifier of big (640x640) chat photo. This file_id can be used only for photo download.
*
* @var string
*/
protected $bigFileId;
/**
* @return string
*/
public function getSmallFileId()
{
return $this->smallFileId;
}
/**
* @param string $smallFileId
*/
public function setSmallFileId($smallFileId)
{
$this->smallFileId = $smallFileId;
}
/**
* @return string
*/
public function getBigFileId()
{
return $this->bigFileId;
}
/**
* @param string $bigFileId
*/
public function setBigFileId($bigFileId)
{
$this->bigFileId = $bigFileId;
}
}
<?php
namespace TelegramBot\Api\Types;
use TelegramBot\Api\BaseType;
use TelegramBot\Api\TypeInterface;
/**
* Class Contact
* This object represents a sticker.
*
* @package TelegramBot\Api\Types
*/
class Contact extends BaseType implements TypeInterface
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['phone_number', 'first_name'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'phone_number' => true,
'first_name' => true,
'last_name' => true,
'user_id' => true
];
/**
* Contact's phone number
*
* @var string
*/
protected $phoneNumber;
/**
* Contact's first name
*
* @var string
*/
protected $firstName;
/**
* Optional. Contact's last name
*
* @var string
*/
protected $lastName;
/**
* Optional. Contact's user identifier in Telegram
*
* @var int
*/
protected $userId;
/**
* @return string
*/
public function getFirstName()
{
return $this->firstName;
}
/**
* @param string $firstName
*/
public function setFirstName($firstName)
{
$this->firstName = $firstName;
}
/**
* @return string
*/
public function getLastName()
{
return $this->lastName;
}
/**
* @param string $lastName
*/
public function setLastName($lastName)
{
$this->lastName = $lastName;
}
/**
* @return string
*/
public function getPhoneNumber()
{
return $this->phoneNumber;
}
/**
* @param string $phoneNumber
*/
public function setPhoneNumber($phoneNumber)
{
$this->phoneNumber = $phoneNumber;
}
/**
* @return int
*/
public function getUserId()
{
return $this->userId;
}
/**
* @param int $userId
*/
public function setUserId($userId)
{
$this->userId = $userId;
}
}
<?php
namespace TelegramBot\Api\Types;
use TelegramBot\Api\BaseType;
use TelegramBot\Api\InvalidArgumentException;
use TelegramBot\Api\TypeInterface;
/**
* Class Document
* This object represents a general file (as opposed to photos and audio files).
* Telegram users can send files of any type of up to 1.5 GB in size.
*
* @package TelegramBot\Api\Types
*/
class Document extends BaseType implements TypeInterface
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'file_id' => true,
'thumb' => PhotoSize::class,
'file_name' => true,
'mime_type' => true,
'file_size' => true
];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['file_id'];
/**
* Unique identifier for this file
*
* @var string
*/
protected $fileId;
/**
* Document thumbnail as defined by sender
*
* @var PhotoSize
*/
protected $thumb;
/**
* Optional. Original filename as defined by sender
*
* @var string
*/
protected $fileName;
/**
* Optional. MIME type of the file as defined by sender
*
* @var string
*/
protected $mimeType;
/**
* Optional. File size
*
* @var int
*/
protected $fileSize;
/**
* @return string
*/
public function getFileId()
{
return $this->fileId;
}
/**
* @param string $fileId
*/
public function setFileId($fileId)
{
$this->fileId = $fileId;
}
/**
* @return string
*/
public function getFileName()
{
return $this->fileName;
}
/**
* @param string $fileName
*/
public function setFileName($fileName)
{
$this->fileName = $fileName;
}
/**
* @return int
*/
public function getFileSize()
{
return $this->fileSize;
}
/**
* @param int $fileSize
*
* @throws InvalidArgumentException
*/
public function setFileSize($fileSize)
{
if (is_integer($fileSize)) {
$this->fileSize = $fileSize;
} else {
throw new InvalidArgumentException();
}
}
/**
* @return string
*/
public function getMimeType()
{
return $this->mimeType;
}
/**
* @param string $mimeType
*/
public function setMimeType($mimeType)
{
$this->mimeType = $mimeType;
}
/**
* @return PhotoSize
*/
public function getThumb()
{
return $this->thumb;
}
/**
* @param PhotoSize $thumb
*/
public function setThumb(PhotoSize $thumb)
{
$this->thumb = $thumb;
}
}
<?php
namespace TelegramBot\Api\Types;
use TelegramBot\Api\BaseType;
use TelegramBot\Api\InvalidArgumentException;
use TelegramBot\Api\TypeInterface;
/**
* Class File
* This object represents a file ready to be downloaded.
* The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>.
* It is guaranteed that the link will be valid for at least 1 hour.
* When the link expires, a new one can be requested by calling getFile.
*
* @package TelegramBot\Api\Types
*/
class File extends BaseType implements TypeInterface
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['file_id'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'file_id' => true,
'file_size' => true,
'file_path' => true
];
/**
* Unique identifier for this file
*
* @var string
*/
protected $fileId;
/**
* Optional. File size, if known
*
* @var int
*/
protected $fileSize;
/**
* Optional. File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file.
*
* @var string
*/
protected $filePath;
/**
* @return string
*/
public function getFileId()
{
return $this->fileId;
}
/**
* @param string $fileId
*/
public function setFileId($fileId)
{
$this->fileId = $fileId;
}
/**
* @return int
*/
public function getFileSize()
{
return $this->fileSize;
}
/**
* @param int $fileSize
*
* @throws InvalidArgumentException
*/
public function setFileSize($fileSize)
{
if (is_integer($fileSize)) {
$this->fileSize = $fileSize;
} else {
throw new InvalidArgumentException();
}
}
/**
* @return string
*/
public function getFilePath()
{
return $this->filePath;
}
/**
* @param string $filePath
*/
public function setFilePath($filePath)
{
$this->filePath = $filePath;
}
}
<?php
namespace TelegramBot\Api\Types;
use TelegramBot\Api\BaseType;
/**
* Class ForceReply
* Upon receiving a message with this object, Telegram clients will display a reply interface to the user
* (act as if the user has selected the bot‘s message and tapped ’Reply').This can be extremely useful
* if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
*
* @package TelegramBot\Api\Types
*/
class ForceReply extends BaseType
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['force_reply'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'force_reply' => true,
'selective' => true
];
/**
* Shows reply interface to the user, as if they manually selected the bot‘s message and tapped ’Reply'
*
* @var bool
*/
protected $forceReply;
/**
* Optional. Use this parameter if you want to show the keyboard to specific users only.
* Targets:
* 1) users that are @mentioned in the text of the Message object;
* 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
*
* @var bool
*/
protected $selective;
public function __construct($forceReply = true, $selective = null)
{
$this->forceReply = $forceReply;
$this->selective = $selective;
}
/**
* @return boolean
*/
public function isForceReply()
{
return $this->forceReply;
}
/**
* @param boolean $forceReply
*/
public function setForceReply($forceReply)
{
$this->forceReply = $forceReply;
}
/**
* @return boolean
*/
public function isSelective()
{
return $this->selective;
}
/**
* @param boolean $selective
*/
public function setSelective($selective)
{
$this->selective = $selective;
}
}
<?php
namespace TelegramBot\Api\Types\Inline;
use TelegramBot\Api\BaseType;
use TelegramBot\Api\Types\Location;
use TelegramBot\Api\Types\User;
/**
* Class ChosenInlineResult
* This object represents a result of an inline query that was chosen by the user and sent to their chat partner.
*
* @package TelegramBot\Api\Types
*/
class ChosenInlineResult extends BaseType
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['result_id', 'from', 'query'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'result_id' => true,
'from' => User::class,
'location' => Location::class,
'inline_message_id' => true,
'query' => true,
];
/**
* The unique identifier for the result that was chosen.
*
* @var string
*/
protected $resultId;
/**
* The user that chose the result.
*
* @var User
*/
protected $from;
/**
* Optional. Sender location, only for bots that require user location
*
* @var Location
*/
protected $location;
/**
* Optional. Identifier of the sent inline message.
* Available only if there is an inline keyboard attached to the message.
* Will be also received in callback queries and can be used to edit the message.
*
* @var string
*/
protected $inlineMessageId;
/**
* The query that was used to obtain the result.
*
* @var string
*/
protected $query;
/**
* @return string
*/
public function getResultId()
{
return $this->resultId;
}
/**
* @param string $resultId
*/
public function setResultId($resultId)
{
$this->resultId = $resultId;
}
/**
* @return User
*/
public function getFrom()
{
return $this->from;
}
/**
* @param User $from
*/
public function setFrom(User $from)
{
$this->from = $from;
}
/**
* @return Location
*/
public function getLocation()
{
return $this->location;
}
/**
* @param Location $location
*/
public function setLocation($location)
{
$this->location = $location;
}
/**
* @return string
*/
public function getInlineMessageId()
{
return $this->inlineMessageId;
}
/**
* @param string $inlineMessageId
*/
public function setInlineMessageId($inlineMessageId)
{
$this->inlineMessageId = $inlineMessageId;
}
/**
* @return string
*/
public function getQuery()
{
return $this->query;
}
/**
* @param string $query
*/
public function setQuery($query)
{
$this->query = $query;
}
}
<?php
/**
* Created by PhpStorm.
* User: YaroslavMolchan
* Date: 16/03/17
* Time: 22:15
*/
namespace TelegramBot\Api\Types\Inline;
use TelegramBot\Api\BaseType;
class InlineKeyboardMarkup extends BaseType
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['inline_keyboard'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'inline_keyboard' => true,
];
/**
* Array of button rows, each represented by an Array of InlineKeyboardButton objects
* Array of Array of InlineKeyboardButton
*
* @var array
*/
protected $inlineKeyboard;
/**
* @param array $inlineKeyboard
*/
public function __construct($inlineKeyboard)
{
$this->inlineKeyboard = $inlineKeyboard;
}
/**
* @return array
*/
public function getInlineKeyboard()
{
return $this->inlineKeyboard;
}
/**
* @param array $inlineKeyboard
*/
public function setInlineKeyboard($inlineKeyboard)
{
$this->inlineKeyboard = $inlineKeyboard;
}
}
<?php
namespace TelegramBot\Api\Types\Inline;
use TelegramBot\Api\BaseType;
use TelegramBot\Api\Types\Location;
use TelegramBot\Api\Types\User;
/**
* Class InlineQuery
* This object represents an incoming inline query.
* When the user sends an empty query, your bot could return some default or trending results.
*
* @package TelegramBot\Api\Types
*/
class InlineQuery extends BaseType
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['id', 'from', 'query', 'offset'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'id' => true,
'from' => User::class,
'location' => Location::class,
'query' => true,
'offset' => true,
];
/**
* Unique identifier for this query
*
* @var string
*/
protected $id;
/**
* Sender
*
* @var User
*/
protected $from;
/**
* Optional. Sender location, only for bots that request user location
*
* @var Location
*/
protected $location;
/**
* Text of the query
*
* @var string
*/
protected $query;
/**
* Offset of the results to be returned, can be controlled by the bot
*
* @var string
*/
protected $offset;
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* @param string $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return User
*/
public function getFrom()
{
return $this->from;
}
/**
* @param User $from
*/
public function setFrom(User $from)
{
$this->from = $from;
}
/**
* @return Location
*/
public function getLocation()
{
return $this->location;
}
/**
* @param Location $location
*/
public function setLocation($location)
{
$this->location = $location;
}
/**
* @return string
*/
public function getQuery()
{
return $this->query;
}
/**
* @param string $query
*/
public function setQuery($query)
{
$this->query = $query;
}
/**
* @return string
*/
public function getOffset()
{
return $this->offset;
}
/**
* @param string $offset
*/
public function setOffset($offset)
{
$this->offset = $offset;
}
}
<?php
/**
* Created by PhpStorm.
* User: iGusev
* Date: 14/04/16
* Time: 04:05
*/
namespace TelegramBot\Api\Types\Inline;
use TelegramBot\Api\BaseType;
class InputMessageContent extends BaseType
{
}
<?php
/**
* Created by PhpStorm.
* User: iGusev
* Date: 14/04/16
* Time: 16:01
*/
namespace TelegramBot\Api\Types\Inline\InputMessageContent;
use TelegramBot\Api\BaseType;
use TelegramBot\Api\TypeInterface;
use TelegramBot\Api\Types\Inline\InputMessageContent;
/**
* Class Contact
*
* @see https://core.telegram.org/bots/api#inputcontactmessagecontent
* Represents the content of a contact message to be sent as the result of an inline query.
*
* @package TelegramBot\Api\Types\Inline
*/
class Contact extends InputMessageContent implements TypeInterface
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['phone_number', 'first_name'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'phone_number' => true,
'first_name' => true,
'last_name' => true,
];
/**
* Contact's phone number
*
* @var string
*/
protected $phoneNumber;
/**
* Contact's first name
*
* @var string
*/
protected $firstName;
/**
* Optional. Contact's last name
*
* @var string
*/
protected $lastName;
/**
* Contact constructor.
*
* @param string $phoneNumber
* @param string $firstName
* @param string|null $lastName
*/
public function __construct($phoneNumber, $firstName, $lastName = null)
{
$this->phoneNumber = $phoneNumber;
$this->firstName = $firstName;
$this->lastName = $lastName;
}
/**
* @return string
*/
public function getPhoneNumber()
{
return $this->phoneNumber;
}
/**
* @param string $phoneNumber
*/
public function setPhoneNumber($phoneNumber)
{
$this->phoneNumber = $phoneNumber;
}
/**
* @return mixed
*/
public function getFirstName()
{
return $this->firstName;
}
/**
* @param mixed $firstName
*/
public function setFirstName($firstName)
{
$this->firstName = $firstName;
}
/**
* @return string
*/
public function getLastName()
{
return $this->lastName;
}
/**
* @param string $lastName
*/
public function setLastName($lastName)
{
$this->lastName = $lastName;
}
}
<?php
/**
* Created by PhpStorm.
* User: iGusev
* Date: 14/04/16
* Time: 15:41
*/
namespace TelegramBot\Api\Types\Inline\InputMessageContent;
use TelegramBot\Api\TypeInterface;
use TelegramBot\Api\Types\Inline\InputMessageContent;
/**
* Class Location
* @see https://core.telegram.org/bots/api#inputlocationmessagecontent
* Represents the content of a location message to be sent as the result of an inline query.
*
* @package TelegramBot\Api\Types\Inline
*/
class Location extends InputMessageContent implements TypeInterface
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['latitude', 'longitude'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'latitude' => true,
'longitude' => true
];
/**
* Latitude of the location in degrees
*
* @var float
*/
protected $latitude;
/**
* Longitude of the location in degrees
*
* @var float
*/
protected $longitude;
/**
* Location constructor.
* @param float $latitude
* @param float $longitude
*/
public function __construct($latitude, $longitude)
{
$this->latitude = $latitude;
$this->longitude = $longitude;
}
/**
* @return float
*/
public function getLatitude()
{
return $this->latitude;
}
/**
* @param float $latitude
*/
public function setLatitude($latitude)
{
$this->latitude = $latitude;
}
/**
* @return float
*/
public function getLongitude()
{
return $this->longitude;
}
/**
* @param float $longitude
*/
public function setLongitude($longitude)
{
$this->longitude = $longitude;
}
}
<?php
/**
* Created by PhpStorm.
* User: iGusev
* Date: 14/04/16
* Time: 14:41
*/
namespace TelegramBot\Api\Types\Inline\InputMessageContent;
use TelegramBot\Api\BaseType;
use TelegramBot\Api\TypeInterface;
use TelegramBot\Api\Types\Inline\InputMessageContent;
/**
* Class Text
* @see https://core.telegram.org/bots/api#inputtextmessagecontent
* Represents the content of a text message to be sent as the result of an inline query.
*
* @package TelegramBot\Api\Types\Inline\InputMessageContent
*/
class Text extends InputMessageContent implements TypeInterface
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['message_text'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'message_text' => true,
'parse_mode' => true,
'disable_web_page_preview' => true,
];
/**
* Text of the message to be sent, 1-4096 characters
*
* @var string
*/
protected $messageText;
/**
* Optional. Send Markdown or HTML,
* if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
*
* @var string
*/
protected $parseMode;
/**
* Optional. Disables link previews for links in the sent message
*
* @var bool
*/
protected $disableWebPagePreview;
/**
* Text constructor.
* @param string $messageText
* @param string $parseMode
* @param bool $disableWebPagePreview
*/
public function __construct($messageText, $parseMode = null, $disableWebPagePreview = false)
{
$this->messageText = $messageText;
$this->parseMode = $parseMode;
$this->disableWebPagePreview = $disableWebPagePreview;
}
/**
* @return string
*/
public function getMessageText()
{
return $this->messageText;
}
/**
* @param string $messageText
*/
public function setMessageText($messageText)
{
$this->messageText = $messageText;
}
/**
* @return string
*/
public function getParseMode()
{
return $this->parseMode;
}
/**
* @param string $parseMode
*/
public function setParseMode($parseMode)
{
$this->parseMode = $parseMode;
}
/**
* @return boolean
*/
public function isDisableWebPagePreview()
{
return $this->disableWebPagePreview;
}
/**
* @param boolean $disableWebPagePreview
*/
public function setDisableWebPagePreview($disableWebPagePreview)
{
$this->disableWebPagePreview = $disableWebPagePreview;
}
}
<?php
/**
* Created by PhpStorm.
* User: iGusev
* Date: 14/04/16
* Time: 15:45
*/
namespace TelegramBot\Api\Types\Inline\InputMessageContent;
use TelegramBot\Api\TypeInterface;
use TelegramBot\Api\Types\Inline\InputMessageContent;
/**
* Class Venue
* @see https://core.telegram.org/bots/api#inputvenuemessagecontent
* Represents the content of a venue message to be sent as the result of an inline query.
*
* @package TelegramBot\Api\Types\Inline
*/
class Venue extends InputMessageContent implements TypeInterface
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['latitude', 'longitude', 'title', 'address'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'latitude' => true,
'longitude' => true,
'title' => true,
'address' => true,
'foursquare_id' => true
];
/**
* Latitude of the venue in degrees
*
* @var float
*/
protected $latitude;
/**
* Longitude of the venue in degrees
*
* @var float
*/
protected $longitude;
/**
* Name of the venue
*
* @var string
*/
protected $title;
/**
* Address of the venue
*
* @var string
*/
protected $address;
/**
* Optional. Foursquare identifier of the venue, if known
*
* @var string
*/
protected $foursquareId;
/**
* Venue constructor.
* @param float $latitude
* @param float $longitude
* @param string $title
* @param string $address
* @param string $foursquareId
*/
public function __construct($latitude, $longitude, $title, $address, $foursquareId = null)
{
$this->latitude = $latitude;
$this->longitude = $longitude;
$this->title = $title;
$this->address = $address;
$this->foursquareId = $foursquareId;
}
/**
* @return float
*/
public function getLatitude()
{
return $this->latitude;
}
/**
* @param float $latitude
*/
public function setLatitude($latitude)
{
$this->latitude = $latitude;
}
/**
* @return float
*/
public function getLongitude()
{
return $this->longitude;
}
/**
* @param float $longitude
*/
public function setLongitude($longitude)
{
$this->longitude = $longitude;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @param string $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* @return string
*/
public function getAddress()
{
return $this->address;
}
/**
* @param string $address
*/
public function setAddress($address)
{
$this->address = $address;
}
/**
* @return string
*/
public function getFoursquareId()
{
return $this->foursquareId;
}
/**
* @param string $foursquareId
*/
public function setFoursquareId($foursquareId)
{
$this->foursquareId = $foursquareId;
}
}
<?php
namespace TelegramBot\Api\Types\Inline\QueryResult;
use TelegramBot\Api\BaseType;
use TelegramBot\Api\Types\Inline\InlineKeyboardMarkup;
use TelegramBot\Api\Types\Inline\InputMessageContent;
/**
* Class AbstractInlineQueryResult
* Abstract class for representing one result of an inline query
*
* @package TelegramBot\Api\Types
*/
class AbstractInlineQueryResult extends BaseType
{
/**
* Type of the result, must be one of: article, photo, gif, mpeg4_gif, video
*
* @var string
*/
protected $type;
/**
* Unique identifier for this result, 1-64 bytes
*
* @var string
*/
protected $id;
/**
* Title for the result
*
* @var string
*/
protected $title;
/**
* Content of the message to be sent instead of the file
*
* @var InputMessageContent
*/
protected $inputMessageContent;
/**
* Optional. Inline keyboard attached to the message
*
* @var InlineKeyboardMarkup
*/
protected $replyMarkup;
/**
* AbstractInlineQueryResult constructor.
*
* @param string $id
* @param string $title
* @param InputMessageContent|null $inputMessageContent
* @param InlineKeyboardMarkup|null $replyMarkup
*/
public function __construct($id, $title, $inputMessageContent = null, $replyMarkup = null)
{
$this->id = $id;
$this->title = $title;
$this->inputMessageContent = $inputMessageContent;
$this->replyMarkup = $replyMarkup;
}
/**
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* @param string $type
*/
public function setType($type)
{
$this->type = $type;
}
/**
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* @param string $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @param string $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* @return InputMessageContent
*/
public function getInputMessageContent()
{
return $this->inputMessageContent;
}
/**
* @param InputMessageContent $inputMessageContent
*/
public function setInputMessageContent($inputMessageContent)
{
$this->inputMessageContent = $inputMessageContent;
}
/**
* @return InlineKeyboardMarkup
*/
public function getReplyMarkup()
{
return $this->replyMarkup;
}
/**
* @param InlineKeyboardMarkup $replyMarkup
*/
public function setReplyMarkup($replyMarkup)
{
$this->replyMarkup = $replyMarkup;
}
}
<?php
namespace TelegramBot\Api\Types\Inline\QueryResult;
use TelegramBot\Api\Types\Inline\InlineKeyboardMarkup;
use TelegramBot\Api\Types\Inline\InputMessageContent;
/**
* Class InlineQueryResultArticle
* Represents a link to an article or web page.
*
* @package TelegramBot\Api\Types\Inline
*/
class Article extends AbstractInlineQueryResult
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['type', 'id', 'title', 'input_message_content'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'type' => true,
'id' => true,
'title' => true,
'input_message_content' => InputMessageContent::class,
'reply_markup' => InlineKeyboardMarkup::class,
'url' => true,
'hide_url' => true,
'description' => true,
'thumb_url' => true,
'thumb_width' => true,
'thumb_height' => true,
];
/**
* {@inheritdoc}
*
* @var string
*/
protected $type = 'article';
/**
* Optional. URL of the result
*
* @var string
*/
protected $url;
/**
* Optional. Pass True, if you don't want the URL to be shown in the message
*
* @var bool
*/
protected $hideUrl;
/**
* Optional. Short description of the result
*
* @var string
*/
protected $description;
/**
* Optional. Url of the thumbnail for the result
*
* @var string
*/
protected $thumbUrl;
/**
* Optional. Thumbnail width
*
* @var int
*/
protected $thumbWidth;
/**
* Optional. Thumbnail height
*
* @var int
*/
protected $thumbHeight;
/**
* InlineQueryResultArticle constructor.
*
* @param string $id
* @param string $title
* @param string|null $description
* @param string|null $thumbUrl
* @param int|null $thumbWidth
* @param int|null $thumbHeight
* @param InputMessageContent $inputMessageContent
* @param InlineKeyboardMarkup|null $inlineKeyboardMarkup
*/
public function __construct(
$id,
$title,
$description = null,
$thumbUrl = null,
$thumbWidth = null,
$thumbHeight = null,
$inputMessageContent = null,
$inlineKeyboardMarkup = null
) {
parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup);
$this->description = $description;
$this->thumbUrl = $thumbUrl;
$this->thumbWidth = $thumbWidth;
$this->thumbHeight = $thumbHeight;
}
/**
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* @param string $url
*/
public function setUrl($url)
{
$this->url = $url;
}
/**
* @return boolean
*/
public function isHideUrl()
{
return $this->hideUrl;
}
/**
* @param boolean $hideUrl
*/
public function setHideUrl($hideUrl)
{
$this->hideUrl = $hideUrl;
}
/**
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* @param string $description
*/
public function setDescription($description)
{
$this->description = $description;
}
/**
* @return string
*/
public function getThumbUrl()
{
return $this->thumbUrl;
}
/**
* @param string $thumbUrl
*/
public function setThumbUrl($thumbUrl)
{
$this->thumbUrl = $thumbUrl;
}
/**
* @return int
*/
public function getThumbWidth()
{
return $this->thumbWidth;
}
/**
* @param int $thumbWidth
*/
public function setThumbWidth($thumbWidth)
{
$this->thumbWidth = $thumbWidth;
}
/**
* @return int
*/
public function getThumbHeight()
{
return $this->thumbHeight;
}
/**
* @param int $thumbHeight
*/
public function setThumbHeight($thumbHeight)
{
$this->thumbHeight = $thumbHeight;
}
}
<?php
/**
* Created by PhpStorm.
* User: iGusev
* Date: 14/04/16
* Time: 16:53
*/
namespace TelegramBot\Api\Types\Inline\QueryResult;
use TelegramBot\Api\Types\Inline\InlineKeyboardMarkup;
use TelegramBot\Api\Types\Inline\InputMessageContent;
/**
* Class Audio
*
* @see https://core.telegram.org/bots/api#inlinequeryresultaudio
* Represents a link to an mp3 audio file. By default, this audio file will be sent by the user.
* Alternatively, you can use InputMessageContent to send a message with the specified content instead of the audio.
*
* Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
*
* @package TelegramBot\Api\Types\Inline\QueryResult
*/
class Audio extends AbstractInlineQueryResult
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['type', 'id', 'audio_url', 'title'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'type' => true,
'id' => true,
'audio_url' => true,
'title' => true,
'performer' => true,
'audio_duration' => true,
'reply_markup' => InlineKeyboardMarkup::class,
'input_message_content' => InputMessageContent::class,
];
/**
* {@inheritdoc}
*
* @var string
*/
protected $type = 'audio';
/**
* A valid URL for the audio file
*
* @var string
*/
protected $audioUrl;
/**
* Optional. Performer
*
* @var string
*/
protected $performer;
/**
* Optional. Audio duration in seconds
*
* @var int
*/
protected $audioDuration;
/**
* Audio constructor.
*
* @param string $id
* @param string $audioUrl
* @param string $title
* @param string|null $performer
* @param int|null $audioDuration
* @param InputMessageContent|null $inputMessageContent
* @param InlineKeyboardMarkup|null $inlineKeyboardMarkup
*/
public function __construct(
$id,
$audioUrl,
$title,
$performer = null,
$audioDuration = null,
$inputMessageContent = null,
$inlineKeyboardMarkup = null
) {
parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup);
$this->audioUrl = $audioUrl;
$this->performer = $performer;
$this->audioDuration = $audioDuration;
}
/**
* @return string
*/
public function getAudioUrl()
{
return $this->audioUrl;
}
/**
* @param string $audioUrl
*/
public function setAudioUrl($audioUrl)
{
$this->audioUrl = $audioUrl;
}
/**
* @return string
*/
public function getPerformer()
{
return $this->performer;
}
/**
* @param string $performer
*/
public function setPerformer($performer)
{
$this->performer = $performer;
}
/**
* @return int
*/
public function getAudioDuration()
{
return $this->audioDuration;
}
/**
* @param int $audioDuration
*/
public function setAudioDuration($audioDuration)
{
$this->audioDuration = $audioDuration;
}
}
<?php
/**
* Created by PhpStorm.
* User: iGusev
* Date: 14/04/16
* Time: 03:58
*/
namespace TelegramBot\Api\Types\Inline\QueryResult;
use TelegramBot\Api\Types\Inline\InlineKeyboardMarkup;
use TelegramBot\Api\Types\Inline\InputMessageContent;
class Contact extends AbstractInlineQueryResult
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['type', 'id', 'phone_number', 'first_name'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'type' => true,
'id' => true,
'phone_number' => true,
'first_name' => true,
'last_name' => true,
'reply_markup' => InlineKeyboardMarkup::class,
'input_message_content' => InputMessageContent::class,
'thumb_url' => true,
'thumb_width' => true,
'thumb_height' => true,
];
/**
* {@inheritdoc}
*
* @var string
*/
protected $type = 'contact';
/**
* Contact's phone number
*
* @var string
*/
protected $phoneNumber;
/**
* Contact's first name
*
* @var string
*/
protected $firstName;
/**
* Optional. Contact's last name
*
* @var string
*/
protected $lastName;
/**
* Optional. Url of the thumbnail for the result
*
* @var string
*/
protected $thumbUrl;
/**
* Optional. Thumbnail width
*
* @var int
*/
protected $thumbWidth;
/**
* Optional. Thumbnail height
*
* @var int
*/
protected $thumbHeight;
/**
* Contact constructor.
*
* @param string $id
* @param string $phoneNumber
* @param string $firstName
* @param string $lastName
* @param string $thumbUrl
* @param int $thumbWidth
* @param int $thumbHeight
* @param InputMessageContent|null $inputMessageContent
* @param InlineKeyboardMarkup|null $inlineKeyboardMarkup
*/
public function __construct(
$id,
$phoneNumber,
$firstName,
$lastName = null,
$thumbUrl = null,
$thumbWidth = null,
$thumbHeight = null,
$inputMessageContent = null,
$inlineKeyboardMarkup = null
) {
parent::__construct($id, null, $inputMessageContent, $inlineKeyboardMarkup);
$this->phoneNumber = $phoneNumber;
$this->firstName = $firstName;
$this->lastName = $lastName;
$this->thumbUrl = $thumbUrl;
$this->thumbWidth = $thumbWidth;
$this->thumbHeight = $thumbHeight;
}
/**
* @return string
*/
public function getPhoneNumber()
{
return $this->phoneNumber;
}
/**
* @param string $phoneNumber
*/
public function setPhoneNumber($phoneNumber)
{
$this->phoneNumber = $phoneNumber;
}
/**
* @return string
*/
public function getFirstName()
{
return $this->firstName;
}
/**
* @param string $firstName
*/
public function setFirstName($firstName)
{
$this->firstName = $firstName;
}
/**
* @return string
*/
public function getLastName()
{
return $this->lastName;
}
/**
* @param string $lastName
*/
public function setLastName($lastName)
{
$this->lastName = $lastName;
}
/**
* @return string
*/
public function getThumbUrl()
{
return $this->thumbUrl;
}
/**
* @param string $thumbUrl
*/
public function setThumbUrl($thumbUrl)
{
$this->thumbUrl = $thumbUrl;
}
/**
* @return int
*/
public function getThumbWidth()
{
return $this->thumbWidth;
}
/**
* @param int $thumbWidth
*/
public function setThumbWidth($thumbWidth)
{
$this->thumbWidth = $thumbWidth;
}
/**
* @return int
*/
public function getThumbHeight()
{
return $this->thumbHeight;
}
/**
* @param int $thumbHeight
*/
public function setThumbHeight($thumbHeight)
{
$this->thumbHeight = $thumbHeight;
}
}
<?php
namespace TelegramBot\Api\Types\Inline\QueryResult;
use TelegramBot\Api\Types\Inline\InlineKeyboardMarkup;
use TelegramBot\Api\Types\Inline\InputMessageContent;
/**
* Class InlineQueryResultGif
* Represents a link to an animated GIF file.
* By default, this animated GIF file will be sent by the user with optional caption.
* Alternatively, you can provide InputMessageContent to send it instead of the animation.
*
* @package TelegramBot\Api\Types\Inline
*/
class Gif extends AbstractInlineQueryResult
{
/**
* {@inheritdoc}
*
* @var array
*/
static protected $requiredParams = ['type', 'id', 'gif_url', 'thumb_url'];
/**
* {@inheritdoc}
*
* @var array
*/
static protected $map = [
'type' => true,
'id' => true,
'gif_url' => true,
'gif_width' => true,
'gif_height' => true,
'thumb_url' => true,
'title' => true,
'caption' => true,
'reply_markup' => InlineKeyboardMarkup::class,
'input_message_content' => InputMessageContent::class,
];
/**
* {@inheritdoc}
*
* @var string
*/
protected $type = 'gif';
/**
* A valid URL for the GIF file. File size must not exceed 1MB
*
* @var string
*/
protected $gifUrl;
/**
* Optional. Width of the GIF
*
* @var int
*/
protected $gifWidth;
/**
* Optional. Height of the GIF
*
* @var int
*/
protected $gifHeight;
/**
* URL of the static thumbnail for the result (jpeg or gif)
*
* @var string
*/
protected $thumbUrl;
/**
* Optional. Caption of the GIF file to be sent, 0-200 characters
*
* @var string
*/
protected $caption;
/**
* InlineQueryResultGif constructor.
*
* @param string $id
* @param string $gifUrl
* @param string $thumbUrl
* @param int|null $gifWidth
* @param int|null $gifHeight
* @param string|null $title
* @param string|null $caption
* @param InputMessageContent $inputMessageContent
* @param InlineKeyboardMarkup|null $inlineKeyboardMarkup
*/
public function __construct(
$id,
$gifUrl,
$thumbUrl = null,
$title = null,
$caption = null,
$gifWidth = null,
$gifHeight = null,
$inputMessageContent = null,
$inlineKeyboardMarkup = null
) {
parent::__construct($id, $title, $inputMessageContent, $inlineKeyboardMarkup);
$this->gifUrl = $gifUrl;
$this->thumbUrl = is_null($thumbUrl) ? $gifUrl : $thumbUrl;
$this->gifWidth = $gifWidth;
$this->gifHeight = $gifHeight;
$this->caption = $caption;
}
/**
* @return string
*/
public function getGifUrl()
{
return $this->gifUrl;
}
/**
* @param string $gifUrl
*/
public function setGifUrl($gifUrl)
{
$this->gifUrl = $gifUrl;
}
/**
* @return int
*/
public function getGifWidth()
{
return $this->gifWidth;
}
/**
* @param int $gifWidth
*/
public function setGifWidth($gifWidth)
{
$this->gifWidth = $gifWidth;
}
/**
* @return int
*/
public function getGifHeight()
{
return $this->gifHeight;
}
/**
* @param int $gifHeight
*/
public function setGifHeight($gifHeight)
{
$this->gifHeight = $gifHeight;
}
/**
* @return string
*/
public function getThumbUrl()
{
return $this->thumbUrl;
}
/**
* @param string $thumbUrl
*/
public function setThumbUrl($thumbUrl)
{
$this->thumbUrl = $thumbUrl;
}
/**
* @return string
*/
public function getCaption()
{
return $this->caption;
}
/**
* @param string $caption
*/
public function setCaption($caption)
{
$this->caption = $caption;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment