diff --git a/server/bots/telegram/Commands/HidekeyboardCommand.php b/server/bots/telegram/Commands/HidekeyboardCommand.php
deleted file mode 100644
index f2190a3..0000000
--- a/server/bots/telegram/Commands/HidekeyboardCommand.php
+++ /dev/null
@@ -1,62 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Longman\TelegramBot\Commands\UserCommands;
-
-use Longman\TelegramBot\Commands\UserCommand;
-use Longman\TelegramBot\Entities\Keyboard;
-use Longman\TelegramBot\Request;
-
-/**
- * User "/hidekeyboard" command
- *
- * Command to hide the keyboard.
- */
-class HidekeyboardCommand extends UserCommand
-{
- /**
- * @var string
- */
- protected $name = 'hidekeyboard';
-
- /**
- * @var string
- */
- protected $description = 'Hide the custom keyboard';
-
- /**
- * @var string
- */
- protected $usage = '/hidekeyboard';
-
- /**
- * @var string
- */
- protected $version = '0.1.0';
-
- /**
- * Command execute method
- *
- * @return \Longman\TelegramBot\Entities\ServerResponse
- * @throws \Longman\TelegramBot\Exception\TelegramException
- */
- public function execute()
- {
- $chat_id = $this->getMessage()->getChat()->getId();
-
- $data = [
- 'chat_id' => $chat_id,
- 'text' => 'Keyboard Hidden',
- 'reply_markup' => Keyboard::remove(),
- ];
-
- return Request::sendMessage($data);
- }
-}
diff --git a/server/bots/telegram/Commands/InlinekeyboardCommand.php b/server/bots/telegram/Commands/InlinekeyboardCommand.php
deleted file mode 100644
index 9799bab..0000000
--- a/server/bots/telegram/Commands/InlinekeyboardCommand.php
+++ /dev/null
@@ -1,74 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Longman\TelegramBot\Commands\UserCommands;
-
-use Longman\TelegramBot\Commands\UserCommand;
-use Longman\TelegramBot\Entities\InlineKeyboard;
-use Longman\TelegramBot\Request;
-
-/**
- * User "/inlinekeyboard" command
- *
- * Display an inline keyboard with a few buttons.
- */
-class InlinekeyboardCommand extends UserCommand
-{
- /**
- * @var string
- */
- protected $name = 'inlinekeyboard';
-
- /**
- * @var string
- */
- protected $description = 'Show inline keyboard';
-
- /**
- * @var string
- */
- protected $usage = '/inlinekeyboard';
-
- /**
- * @var string
- */
- protected $version = '0.1.0';
-
- /**
- * Command execute method
- *
- * @return \Longman\TelegramBot\Entities\ServerResponse
- * @throws \Longman\TelegramBot\Exception\TelegramException
- */
- public function execute()
- {
- $chat_id = $this->getMessage()->getChat()->getId();
-
- $switch_element = random_int(0, 9) < 5 ? 'true' : 'false';
-
- $inline_keyboard = new InlineKeyboard(
- [
- ['text' => 'inline', 'switch_inline_query' => $switch_element],
- ['text' => 'inline current chat', 'switch_inline_query_current_chat' => $switch_element],
- ], [
- ['text' => 'callback', 'callback_data' => 'identifier'],
- ['text' => 'open url', 'url' => 'https://github.com/php-telegram-bot/core'],
- ]
- );
-
- $data = [
- 'chat_id' => $chat_id,
- 'text' => 'inline keyboard',
- 'reply_markup' => $inline_keyboard,
- ];
-
- return Request::sendMessage($data);
- }
-}
diff --git a/server/bots/telegram/Commands/KeyboardCommand.php b/server/bots/telegram/Commands/KeyboardCommand.php
deleted file mode 100644
index 38ed2c7..0000000
--- a/server/bots/telegram/Commands/KeyboardCommand.php
+++ /dev/null
@@ -1,110 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Longman\TelegramBot\Commands\UserCommands;
-
-use Longman\TelegramBot\Commands\UserCommand;
-use Longman\TelegramBot\Entities\Keyboard;
-use Longman\TelegramBot\Request;
-
-/**
- * User "/keyboard" command
- *
- * Display a keyboard with a few buttons.
- */
-class KeyboardCommand extends UserCommand
-{
- /**
- * @var string
- */
- protected $name = 'keyboard';
-
- /**
- * @var string
- */
- protected $description = 'Show a custom keyboard with reply markup';
-
- /**
- * @var string
- */
- protected $usage = '/keyboard';
-
- /**
- * @var string
- */
- protected $version = '0.2.0';
-
- /**
- * Command execute method
- *
- * @return \Longman\TelegramBot\Entities\ServerResponse
- * @throws \Longman\TelegramBot\Exception\TelegramException
- */
- public function execute()
- {
- //Keyboard examples
- /**
-*
- *
- * @var Keyboard[] $keyboards
-*/
- $keyboards = [];
-
- //Example 0
- $keyboards[] = new Keyboard(
- ['7', '8', '9'],
- ['4', '5', '6'],
- ['1', '2', '3'],
- [' ', '0', ' ']
- );
-
- //Example 1
- $keyboards[] = new Keyboard(
- ['7', '8', '9', '+'],
- ['4', '5', '6', '-'],
- ['1', '2', '3', '*'],
- [' ', '0', ' ', '/']
- );
-
- //Example 2
- $keyboards[] = new Keyboard('A', 'B', 'C');
-
- //Example 3
- $keyboards[] = new Keyboard(
- ['text' => 'A'],
- 'B',
- ['C', 'D']
- );
-
- //Example 4 (bots version 2.0)
- $keyboards[] = new Keyboard(
- [
- ['text' => 'Send my contact', 'request_contact' => true],
- ['text' => 'Send my location', 'request_location' => true],
- ]
- );
-
- //Return a random keyboard.
- //$keyboard = $keyboards[random_int(0, count($keyboards) - 1)]
- $keyboard = $keyboards[4]
- ->setResizeKeyboard(true)
- ->setOneTimeKeyboard(true)
- ->setSelective(false);
-
- $chat_id = $this->getMessage()->getChat()->getId();
- $data = [
- 'chat_id' => $chat_id,
- 'text' => 'Press a Button:',
- 'reply_markup' => $keyboard,
- ];
-
- return Request::sendMessage($data);
- }
-}
diff --git a/server/bots/telegram/Commands/StartCommand.php b/server/bots/telegram/Commands/StartCommand.php
deleted file mode 100644
index 7cfbaed..0000000
--- a/server/bots/telegram/Commands/StartCommand.php
+++ /dev/null
@@ -1,69 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Longman\TelegramBot\Commands\SystemCommands;
-
-use Longman\TelegramBot\Commands\SystemCommand;
-use Longman\TelegramBot\Request;
-
-/**
- * Start command
- *
- * Gets executed when a user first starts using the bot.
- */
-class StartCommand extends SystemCommand
-{
- /**
- * @var string
- */
- protected $name = 'start';
-
- /**
- * @var string
- */
- protected $description = 'Start command';
-
- /**
- * @var string
- */
- protected $usage = '/start';
-
- /**
- * @var string
- */
- protected $version = '1.1.0';
-
- /**
- * @var bool
- */
- protected $private_only = true;
-
- /**
- * Command execute method
- *
- * @return \Longman\TelegramBot\Entities\ServerResponse
- * @throws \Longman\TelegramBot\Exception\TelegramException
- */
- public function execute()
- {
- $message = $this->getMessage();
-
- $chat_id = $message->getChat()->getId();
-
- $text = 'Hi there!' . PHP_EOL . 'Type /help to see all commands!';
-
- $data = [
- 'chat_id' => $chat_id,
- 'text' => $text,
- ];
-
- return Request::sendMessage($data);
- }
-}
diff --git a/server/bots/telegram/composer.json b/server/bots/telegram/composer.json
deleted file mode 100644
index 6513806..0000000
--- a/server/bots/telegram/composer.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "name": "matteo/allerta-vvf_telegram-bot",
- "description": "Telegram Bot for matteo/allerta-vvf",
- "type": "project",
- "require": {
- "longman/telegram-bot": "0.74.0"
- },
- "require-dev": {
- "monolog/monolog": "2.3.2"
- },
- "license": "GPL3.0",
- "authors": [
- {
- "name": "Matteo Gheza",
- "email": "matteo.gheza07@gmail.com"
- }
- ],
- "minimum-stability": "stable"
-}
diff --git a/server/bots/telegram/composer.lock b/server/bots/telegram/composer.lock
deleted file mode 100644
index 8149d33..0000000
--- a/server/bots/telegram/composer.lock
+++ /dev/null
@@ -1,616 +0,0 @@
-{
- "_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#installing-dependencies",
- "This file is @generated automatically"
- ],
- "content-hash": "7497f2ef904e993d82937d2e129f60d4",
- "packages": [
- {
- "name": "guzzlehttp/guzzle",
- "version": "7.3.0",
- "source": {
- "type": "git",
- "url": "https://github.com/guzzle/guzzle.git",
- "reference": "7008573787b430c1c1f650e3722d9bba59967628"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7008573787b430c1c1f650e3722d9bba59967628",
- "reference": "7008573787b430c1c1f650e3722d9bba59967628",
- "shasum": ""
- },
- "require": {
- "ext-json": "*",
- "guzzlehttp/promises": "^1.4",
- "guzzlehttp/psr7": "^1.7 || ^2.0",
- "php": "^7.2.5 || ^8.0",
- "psr/http-client": "^1.0"
- },
- "provide": {
- "psr/http-client-implementation": "1.0"
- },
- "require-dev": {
- "bamarni/composer-bin-plugin": "^1.4.1",
- "ext-curl": "*",
- "php-http/client-integration-tests": "^3.0",
- "phpunit/phpunit": "^8.5.5 || ^9.3.5",
- "psr/log": "^1.1"
- },
- "suggest": {
- "ext-curl": "Required for CURL handler support",
- "ext-intl": "Required for Internationalized Domain Name (IDN) support",
- "psr/log": "Required for using the Log middleware"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "7.3-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "GuzzleHttp\\": "src/"
- },
- "files": [
- "src/functions_include.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Michael Dowling",
- "email": "mtdowling@gmail.com",
- "homepage": "https://github.com/mtdowling"
- },
- {
- "name": "Márk Sági-Kazár",
- "email": "mark.sagikazar@gmail.com",
- "homepage": "https://sagikazarmark.hu"
- }
- ],
- "description": "Guzzle is a PHP HTTP client library",
- "homepage": "http://guzzlephp.org/",
- "keywords": [
- "client",
- "curl",
- "framework",
- "http",
- "http client",
- "psr-18",
- "psr-7",
- "rest",
- "web service"
- ],
- "funding": [
- {
- "url": "https://github.com/GrahamCampbell",
- "type": "github"
- },
- {
- "url": "https://github.com/Nyholm",
- "type": "github"
- },
- {
- "url": "https://github.com/alexeyshockov",
- "type": "github"
- },
- {
- "url": "https://github.com/gmponos",
- "type": "github"
- }
- ],
- "time": "2021-03-23T11:33:13+00:00"
- },
- {
- "name": "guzzlehttp/promises",
- "version": "1.4.1",
- "source": {
- "type": "git",
- "url": "https://github.com/guzzle/promises.git",
- "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d",
- "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d",
- "shasum": ""
- },
- "require": {
- "php": ">=5.5"
- },
- "require-dev": {
- "symfony/phpunit-bridge": "^4.4 || ^5.1"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.4-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "GuzzleHttp\\Promise\\": "src/"
- },
- "files": [
- "src/functions_include.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Michael Dowling",
- "email": "mtdowling@gmail.com",
- "homepage": "https://github.com/mtdowling"
- }
- ],
- "description": "Guzzle promises library",
- "keywords": [
- "promise"
- ],
- "time": "2021-03-07T09:25:29+00:00"
- },
- {
- "name": "guzzlehttp/psr7",
- "version": "1.8.2",
- "source": {
- "type": "git",
- "url": "https://github.com/guzzle/psr7.git",
- "reference": "dc960a912984efb74d0a90222870c72c87f10c91"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/guzzle/psr7/zipball/dc960a912984efb74d0a90222870c72c87f10c91",
- "reference": "dc960a912984efb74d0a90222870c72c87f10c91",
- "shasum": ""
- },
- "require": {
- "php": ">=5.4.0",
- "psr/http-message": "~1.0",
- "ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
- },
- "provide": {
- "psr/http-message-implementation": "1.0"
- },
- "require-dev": {
- "ext-zlib": "*",
- "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10"
- },
- "suggest": {
- "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.7-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "GuzzleHttp\\Psr7\\": "src/"
- },
- "files": [
- "src/functions_include.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Michael Dowling",
- "email": "mtdowling@gmail.com",
- "homepage": "https://github.com/mtdowling"
- },
- {
- "name": "Tobias Schultze",
- "homepage": "https://github.com/Tobion"
- }
- ],
- "description": "PSR-7 message implementation that also provides common utility methods",
- "keywords": [
- "http",
- "message",
- "psr-7",
- "request",
- "response",
- "stream",
- "uri",
- "url"
- ],
- "time": "2021-04-26T09:17:50+00:00"
- },
- {
- "name": "longman/telegram-bot",
- "version": "0.74.0",
- "source": {
- "type": "git",
- "url": "https://github.com/php-telegram-bot/core.git",
- "reference": "6d62ea1ca64c60ad83468715f9938bd1a95c3a09"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/php-telegram-bot/core/zipball/6d62ea1ca64c60ad83468715f9938bd1a95c3a09",
- "reference": "6d62ea1ca64c60ad83468715f9938bd1a95c3a09",
- "shasum": ""
- },
- "require": {
- "ext-curl": "*",
- "ext-json": "*",
- "ext-mbstring": "*",
- "ext-pdo": "*",
- "guzzlehttp/guzzle": "^6.0|^7.0",
- "php": "^7.3|^8.0",
- "psr/log": "^1.1"
- },
- "require-dev": {
- "dms/phpunit-arraysubset-asserts": "^0.2",
- "monolog/monolog": "^2.1",
- "phpunit/phpunit": "^9.5",
- "squizlabs/php_codesniffer": "^3.5"
- },
- "type": "library",
- "autoload": {
- "psr-4": {
- "Longman\\TelegramBot\\": "src"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Avtandil Kikabidze aka LONGMAN",
- "email": "akalongman@gmail.com",
- "homepage": "http://longman.me",
- "role": "Developer"
- },
- {
- "name": "Armando Lüscher",
- "email": "armando@noplanman.ch",
- "homepage": "https://noplanman.ch",
- "role": "Developer"
- },
- {
- "name": "PHP Telegram Bot Team",
- "homepage": "https://github.com/php-telegram-bot/core/graphs/contributors",
- "role": "Developer"
- }
- ],
- "description": "PHP Telegram bot",
- "homepage": "https://github.com/php-telegram-bot/core",
- "keywords": [
- "api",
- "bot",
- "telegram"
- ],
- "funding": [
- {
- "url": "https://github.com/php-telegram-bot/core#donate",
- "type": "custom"
- },
- {
- "url": "https://github.com/noplanman",
- "type": "github"
- },
- {
- "url": "https://ko-fi.com/phptelegrambot",
- "type": "ko_fi"
- },
- {
- "url": "https://liberapay.com/PHP-Telegram-Bot",
- "type": "liberapay"
- },
- {
- "url": "https://opencollective.com/php-telegram-bot",
- "type": "open_collective"
- },
- {
- "url": "https://www.patreon.com/phptelegrambot",
- "type": "patreon"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/longman/telegram-bot",
- "type": "tidelift"
- }
- ],
- "time": "2021-06-26T18:15:19+00:00"
- },
- {
- "name": "psr/http-client",
- "version": "1.0.1",
- "source": {
- "type": "git",
- "url": "https://github.com/php-fig/http-client.git",
- "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
- "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
- "shasum": ""
- },
- "require": {
- "php": "^7.0 || ^8.0",
- "psr/http-message": "^1.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Psr\\Http\\Client\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "PHP-FIG",
- "homepage": "http://www.php-fig.org/"
- }
- ],
- "description": "Common interface for HTTP clients",
- "homepage": "https://github.com/php-fig/http-client",
- "keywords": [
- "http",
- "http-client",
- "psr",
- "psr-18"
- ],
- "time": "2020-06-29T06:28:15+00:00"
- },
- {
- "name": "psr/http-message",
- "version": "1.0.1",
- "source": {
- "type": "git",
- "url": "https://github.com/php-fig/http-message.git",
- "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
- "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Psr\\Http\\Message\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "PHP-FIG",
- "homepage": "http://www.php-fig.org/"
- }
- ],
- "description": "Common interface for HTTP messages",
- "homepage": "https://github.com/php-fig/http-message",
- "keywords": [
- "http",
- "http-message",
- "psr",
- "psr-7",
- "request",
- "response"
- ],
- "time": "2016-08-06T14:39:51+00:00"
- },
- {
- "name": "psr/log",
- "version": "1.1.4",
- "source": {
- "type": "git",
- "url": "https://github.com/php-fig/log.git",
- "reference": "d49695b909c3b7628b6289db5479a1c204601f11"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
- "reference": "d49695b909c3b7628b6289db5479a1c204601f11",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.1.x-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Psr\\Log\\": "Psr/Log/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "PHP-FIG",
- "homepage": "https://www.php-fig.org/"
- }
- ],
- "description": "Common interface for logging libraries",
- "homepage": "https://github.com/php-fig/log",
- "keywords": [
- "log",
- "psr",
- "psr-3"
- ],
- "time": "2021-05-03T11:20:27+00:00"
- },
- {
- "name": "ralouphie/getallheaders",
- "version": "3.0.3",
- "source": {
- "type": "git",
- "url": "https://github.com/ralouphie/getallheaders.git",
- "reference": "120b605dfeb996808c31b6477290a714d356e822"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
- "reference": "120b605dfeb996808c31b6477290a714d356e822",
- "shasum": ""
- },
- "require": {
- "php": ">=5.6"
- },
- "require-dev": {
- "php-coveralls/php-coveralls": "^2.1",
- "phpunit/phpunit": "^5 || ^6.5"
- },
- "type": "library",
- "autoload": {
- "files": [
- "src/getallheaders.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Ralph Khattar",
- "email": "ralph.khattar@gmail.com"
- }
- ],
- "description": "A polyfill for getallheaders.",
- "time": "2019-03-08T08:55:37+00:00"
- }
- ],
- "packages-dev": [
- {
- "name": "monolog/monolog",
- "version": "2.3.2",
- "source": {
- "type": "git",
- "url": "https://github.com/Seldaek/monolog.git",
- "reference": "71312564759a7db5b789296369c1a264efc43aad"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/Seldaek/monolog/zipball/71312564759a7db5b789296369c1a264efc43aad",
- "reference": "71312564759a7db5b789296369c1a264efc43aad",
- "shasum": ""
- },
- "require": {
- "php": ">=7.2",
- "psr/log": "^1.0.1"
- },
- "provide": {
- "psr/log-implementation": "1.0.0"
- },
- "require-dev": {
- "aws/aws-sdk-php": "^2.4.9 || ^3.0",
- "doctrine/couchdb": "~1.0@dev",
- "elasticsearch/elasticsearch": "^7",
- "graylog2/gelf-php": "^1.4.2",
- "mongodb/mongodb": "^1.8",
- "php-amqplib/php-amqplib": "~2.4",
- "php-console/php-console": "^3.1.3",
- "phpspec/prophecy": "^1.6.1",
- "phpstan/phpstan": "^0.12.91",
- "phpunit/phpunit": "^8.5",
- "predis/predis": "^1.1",
- "rollbar/rollbar": "^1.3",
- "ruflin/elastica": ">=0.90 <7.0.1",
- "swiftmailer/swiftmailer": "^5.3|^6.0"
- },
- "suggest": {
- "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
- "doctrine/couchdb": "Allow sending log messages to a CouchDB server",
- "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client",
- "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
- "ext-mbstring": "Allow to work properly with unicode symbols",
- "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)",
- "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
- "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
- "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
- "php-console/php-console": "Allow sending log messages to Google Chrome",
- "rollbar/rollbar": "Allow sending log messages to Rollbar",
- "ruflin/elastica": "Allow sending log messages to an Elastic Search server"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-main": "2.x-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Monolog\\": "src/Monolog"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jordi Boggiano",
- "email": "j.boggiano@seld.be",
- "homepage": "https://seld.be"
- }
- ],
- "description": "Sends your logs to files, sockets, inboxes, databases and various web services",
- "homepage": "https://github.com/Seldaek/monolog",
- "keywords": [
- "log",
- "logging",
- "psr-3"
- ],
- "funding": [
- {
- "url": "https://github.com/Seldaek",
- "type": "github"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/monolog/monolog",
- "type": "tidelift"
- }
- ],
- "time": "2021-07-23T07:42:52+00:00"
- }
- ],
- "aliases": [],
- "minimum-stability": "stable",
- "stability-flags": [],
- "prefer-stable": false,
- "prefer-lowest": false,
- "platform": [],
- "platform-dev": [],
- "plugin-api-version": "1.1.0"
-}
diff --git a/server/bots/telegram/getUpdatesCLI.php b/server/bots/telegram/getUpdatesCLI.php
deleted file mode 100644
index 130201c..0000000
--- a/server/bots/telegram/getUpdatesCLI.php
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env php
- 'localhost',
- 'user' => 'dbuser',
- 'password' => 'dbpass',
- 'database' => 'dbname',
-];*/
-
-try {
- // Create Telegram API object
- $telegram = new Longman\TelegramBot\Telegram($bot_api_key, $bot_username);
-
- // Add commands paths containing your custom commands
- $telegram->addCommandsPaths($commands_paths);
-
- // Enable admin users
- $telegram->enableAdmins($admin_users);
-
- // Enable MySQL
- //$telegram->enableMySql($mysql_credentials);
- $telegram->useGetUpdatesWithoutDatabase();
-
- // Logging (Error, Debug and Raw Updates)
- // https://github.com/php-telegram-bot/core/blob/master/doc/01-utils.md#logging
- //
- // (this example requires Monolog: composer require monolog/monolog)
- //Longman\TelegramBot\TelegramLog::initialize(
- // new Monolog\Logger('telegram_bot', [
- // (new Monolog\Handler\StreamHandler(__DIR__ . "/{$bot_username}_debug.log", Monolog\Logger::DEBUG))->setFormatter(new Monolog\Formatter\LineFormatter(null, null, true)),
- // (new Monolog\Handler\StreamHandler(__DIR__ . "/{$bot_username}_error.log", Monolog\Logger::ERROR))->setFormatter(new Monolog\Formatter\LineFormatter(null, null, true)),
- // ]),
- // new Monolog\Logger('telegram_bot_updates', [
- // (new Monolog\Handler\StreamHandler(__DIR__ . "/{$bot_username}_update.log", Monolog\Logger::INFO))->setFormatter(new Monolog\Formatter\LineFormatter('%message%' . PHP_EOL)),
- // ])
- //);
-
- // Set custom Upload and Download paths
- //$telegram->setDownloadPath(__DIR__ . '/Download');
- //$telegram->setUploadPath(__DIR__ . '/Upload');
-
- // Here you can set some command specific parameters
- // e.g. Google geocode/timezone api key for /date command
- //$telegram->setCommandConfig('date', ['google_api_key' => 'your_google_api_key_here']);
-
- // Requests Limiter (tries to prevent reaching Telegram API limits)
- $telegram->enableLimiter();
-
- // Handle telegram getUpdates request
- $server_response = $telegram->handleGetUpdates();
-
- if ($server_response->isOk()) {
- $update_count = count($server_response->getResult());
- echo date('Y-m-d H:i:s', time()) . ' - Processed ' . $update_count . ' updates';
- } else {
- echo date('Y-m-d H:i:s', time()) . ' - Failed to fetch updates' . PHP_EOL;
- echo $server_response->printError();
- }
-} catch (Longman\TelegramBot\Exception\TelegramException $e) {
- echo $e->getMessage();
- // Log telegram errors
- Longman\TelegramBot\TelegramLog::error($e);
-} catch (Longman\TelegramBot\Exception\TelegramLogException $e) {
- // Catch log initialisation errors
- echo $e->getMessage();
-}
diff --git a/server/composer.json b/server/composer.json
index 25a2791..6c2c7b4 100644
--- a/server/composer.json
+++ b/server/composer.json
@@ -29,7 +29,8 @@
"jenstornell/tiny-html-minifier": "dev-master",
"delight-im/db": "1.3.1",
"webonyx/graphql-php": "14.9.0",
- "phpfastcache/phpfastcache": "8.0.8"
+ "phpfastcache/phpfastcache": "8.0.8",
+ "skrtdev/novagram": "^1.10"
},
"license": "GPL-3.0-or-later",
"authors": [
diff --git a/server/composer.lock b/server/composer.lock
index 7113032..59c1481 100644
--- a/server/composer.lock
+++ b/server/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "e3c2284671c93e457a9801d5824a46e8",
+ "content-hash": "f0cb02a6bdec23d2be598a0d31268523",
"packages": [
{
"name": "azuyalabs/yasumi",
@@ -1006,6 +1006,102 @@
},
"time": "2021-03-09T07:50:25+00:00"
},
+ {
+ "name": "monolog/monolog",
+ "version": "2.3.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Seldaek/monolog.git",
+ "reference": "71312564759a7db5b789296369c1a264efc43aad"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Seldaek/monolog/zipball/71312564759a7db5b789296369c1a264efc43aad",
+ "reference": "71312564759a7db5b789296369c1a264efc43aad",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.2",
+ "psr/log": "^1.0.1"
+ },
+ "provide": {
+ "psr/log-implementation": "1.0.0"
+ },
+ "require-dev": {
+ "aws/aws-sdk-php": "^2.4.9 || ^3.0",
+ "doctrine/couchdb": "~1.0@dev",
+ "elasticsearch/elasticsearch": "^7",
+ "graylog2/gelf-php": "^1.4.2",
+ "mongodb/mongodb": "^1.8",
+ "php-amqplib/php-amqplib": "~2.4",
+ "php-console/php-console": "^3.1.3",
+ "phpspec/prophecy": "^1.6.1",
+ "phpstan/phpstan": "^0.12.91",
+ "phpunit/phpunit": "^8.5",
+ "predis/predis": "^1.1",
+ "rollbar/rollbar": "^1.3",
+ "ruflin/elastica": ">=0.90 <7.0.1",
+ "swiftmailer/swiftmailer": "^5.3|^6.0"
+ },
+ "suggest": {
+ "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
+ "doctrine/couchdb": "Allow sending log messages to a CouchDB server",
+ "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client",
+ "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
+ "ext-mbstring": "Allow to work properly with unicode symbols",
+ "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)",
+ "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
+ "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
+ "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
+ "php-console/php-console": "Allow sending log messages to Google Chrome",
+ "rollbar/rollbar": "Allow sending log messages to Rollbar",
+ "ruflin/elastica": "Allow sending log messages to an Elastic Search server"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "2.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Monolog\\": "src/Monolog"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jordi Boggiano",
+ "email": "j.boggiano@seld.be",
+ "homepage": "https://seld.be"
+ }
+ ],
+ "description": "Sends your logs to files, sockets, inboxes, databases and various web services",
+ "homepage": "https://github.com/Seldaek/monolog",
+ "keywords": [
+ "log",
+ "logging",
+ "psr-3"
+ ],
+ "support": {
+ "issues": "https://github.com/Seldaek/monolog/issues",
+ "source": "https://github.com/Seldaek/monolog/tree/2.3.2"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/Seldaek",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/monolog/monolog",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2021-07-23T07:42:52+00:00"
+ },
{
"name": "nikic/fast-route",
"version": "dev-master",
@@ -2142,6 +2238,111 @@
],
"time": "2021-07-19T08:09:34+00:00"
},
+ {
+ "name": "skrtdev/async",
+ "version": "v1.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/skrtdev/php-async.git",
+ "reference": "b5e3f58b0be1c351db2049519750f29b7a143a7b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/skrtdev/php-async/zipball/b5e3f58b0be1c351db2049519750f29b7a143a7b",
+ "reference": "b5e3f58b0be1c351db2049519750f29b7a143a7b",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.4"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "skrtdev\\async\\": "src/"
+ },
+ "files": [
+ "src/range.php",
+ "src/helpers.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Gaetano Sutera",
+ "email": "gaetanosutera@yahoo.it",
+ "role": "Developer"
+ }
+ ],
+ "support": {
+ "issues": "https://github.com/skrtdev/php-async/issues",
+ "source": "https://github.com/skrtdev/php-async/tree/v1.1.1"
+ },
+ "time": "2021-05-12T08:55:24+00:00"
+ },
+ {
+ "name": "skrtdev/novagram",
+ "version": "v1.10",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/skrtdev/NovaGram.git",
+ "reference": "44b340b0fb00492d4b85c7c4b2f43720ea1b902b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/skrtdev/NovaGram/zipball/44b340b0fb00492d4b85c7c4b2f43720ea1b902b",
+ "reference": "44b340b0fb00492d4b85c7c4b2f43720ea1b902b",
+ "shasum": ""
+ },
+ "require": {
+ "ext-curl": "*",
+ "ext-json": "*",
+ "monolog/monolog": "^2.1",
+ "php": ">=7.4",
+ "skrtdev/async": "^1.0",
+ "symfony/polyfill-php80": "^1.22"
+ },
+ "suggest": {
+ "ext-mbstring": "Needed to use the built-in Telegram Entites Parser",
+ "ext-pcntl": "Needed to process updates with multi-processing",
+ "ext-pdo": "Needed to use the built-in Database"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "skrtdev\\Telegram\\": [
+ "src/Telegram/Types",
+ "src/Telegram/Exceptions"
+ ],
+ "skrtdev\\": "src/"
+ },
+ "classmap": [
+ "src/bc"
+ ],
+ "files": [
+ "src/NovaGram/helpers.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Gaetano Sutera",
+ "email": "gaetanosutera@yahoo.it",
+ "role": "Developer"
+ }
+ ],
+ "description": "An Object-Oriented PHP Library for Telegram Bots",
+ "support": {
+ "issues": "https://github.com/skrtdev/NovaGram/issues",
+ "source": "https://github.com/skrtdev/NovaGram/tree/v1.10"
+ },
+ "time": "2021-05-05T16:02:13+00:00"
+ },
{
"name": "spatie/array-to-xml",
"version": "2.16.0",
@@ -3377,5 +3578,5 @@
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
- "plugin-api-version": "2.0.0"
+ "plugin-api-version": "2.1.0"
}
diff --git a/server/config-sample.php b/server/config-sample.php
index 3150ff4..7b1d03c 100644
--- a/server/config-sample.php
+++ b/server/config-sample.php
@@ -15,6 +15,10 @@ define('DB_HOST', '@@host@@');
/* Database hostname */
define('DB_PREFIX', '@@prefix@@');
+/* Telegram bot options */
+define('BOT_TELEGRAM_API_KEY', '');
+define('BOT_TELEGRAM_USERNAME', '');
+
/* Sentry options */
define('SENTRY_CSP_REPORT_URI', '');
define('SENTRY_ENABLED', false);
diff --git a/server/install/installHelper.php b/server/install/installHelper.php
index f564fde..c3250c4 100644
--- a/server/install/installHelper.php
+++ b/server/install/installHelper.php
@@ -232,6 +232,10 @@ define( 'DB_HOST', '' );
/* Database hostname */
define( 'DB_PREFIX', '' );
+/* Telegram bot options */
+define('BOT_TELEGRAM_API_KEY', '');
+define('BOT_TELEGRAM_USERNAME', '');
+
/* Sentry options */
define('SENTRY_CSP_REPORT_URI', '');
define('SENTRY_ENABLED', false);
@@ -444,6 +448,7 @@ $db->exec(<<<"EOL"
CREATE TABLE `{$prefix}_bot_telegram` (
`id` INT NOT NULL AUTO_INCREMENT,
`chat_id` VARCHAR(128) NOT NULL,
+`tmp_login_token` VARCHAR(128) NOT NULL,
`user` INT NOT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET=latin1;
diff --git a/server/install/runInstall.php b/server/install/runInstall.php
deleted file mode 100644
index e69de29..0000000
diff --git a/server/resources/ajax/ajax_add_bot_telegram_user.php b/server/resources/ajax/ajax_add_bot_telegram_user.php
new file mode 100644
index 0000000..eba6912
--- /dev/null
+++ b/server/resources/ajax/ajax_add_bot_telegram_user.php
@@ -0,0 +1,12 @@
+requirelogin(false);
+
+$tmp_token = $tools->generateNonce(32);
+$db->insert(
+ DB_PREFIX."_bot_telegram",
+ ["tmp_login_token" => $tmp_token, "user" => $user->auth->getUserId()]
+);
+
+echo(json_encode(["token" => $tmp_token, "url" => "https://t.me/". BOT_TELEGRAM_USERNAME ."?start={$tmp_token}"]));
\ No newline at end of file
diff --git a/server/telegram_bot.php b/server/telegram_bot.php
new file mode 100644
index 0000000..acd0878
--- /dev/null
+++ b/server/telegram_bot.php
@@ -0,0 +1,24 @@
+addErrorHandler(function ($e) {
+ print('Caught '.get_class($e).' exception from general handler'.PHP_EOL);
+ print($e.PHP_EOL);
+});
+
+$Bot->onCommand('start', function (Message $message, array $args = []) {
+ var_dump($message, $args);
+ $message->reply('Hey! Nice to meet you. Use /info to know more about me.');
+});
+
+$Bot->onCommand('info', function (Message $message) {
+ $message->reply('Well, I\'m just an example, but you can learn more about NovaGram at docs.novagram.ga');
+});
+
+$Bot->start();