From 815960c9ada0492ef32354c510d86e66d444f42f Mon Sep 17 00:00:00 2001 From: Remigijus Kiminas Date: Tue, 12 Sep 2023 08:20:34 -0400 Subject: [PATCH] Quick reply buttons support --- bootstrap/bootstrap.php | 44 +- classes/Commands/CallbackqueryCommand.php | 34 +- classes/Commands/ChangeownerCommand.php | 8 +- .../Commands/ChannelchatcreatedCommand.php | 50 -- classes/Commands/ChannelpostCommand.php | 49 -- classes/Commands/ChatCommand.php | 4 +- classes/Commands/ChatsCommand.php | 20 +- .../Commands/ChoseninlineresultCommand.php | 51 -- classes/Commands/DeletechatphotoCommand.php | 50 -- classes/Commands/EditedchannelpostCommand.php | 49 -- classes/Commands/EndchatCommand.php | 3 +- classes/Commands/GenericCommand.php | 5 +- classes/Commands/GenericmessageCommand.php | 74 ++- classes/Commands/GroupchatcreatedCommand.php | 50 -- classes/Commands/HelpCommand.php | 3 +- classes/Commands/InlinequeryCommand.php | 3 +- classes/Commands/LeftchatmemberCommand.php | 50 -- classes/Commands/MigratefromchatidCommand.php | 50 -- classes/Commands/MigratetochatidCommand.php | 50 -- classes/Commands/NewchatmembersCommand.php | 66 -- classes/Commands/NewchatphotoCommand.php | 50 -- classes/Commands/NewchattitleCommand.php | 50 -- classes/Commands/PinnedmessageCommand.php | 4 +- classes/Commands/RegisterCommand.php | 4 +- classes/Commands/StartCommand.php | 3 +- .../Commands/SupergroupchatcreatedCommand.php | 3 +- classes/Commands/WhoamiCommand.php | 3 +- composer.json | 2 +- composer.lock | 587 ++++++++++++------ ...nsion_information_row_multiinclude.tpl.php | 2 +- doc/install.sql | 12 +- doc/structure.json | 38 +- modules/lhtelegram/callback.php | 8 +- 33 files changed, 605 insertions(+), 874 deletions(-) delete mode 100644 classes/Commands/ChannelchatcreatedCommand.php delete mode 100644 classes/Commands/ChannelpostCommand.php delete mode 100644 classes/Commands/ChoseninlineresultCommand.php delete mode 100644 classes/Commands/DeletechatphotoCommand.php delete mode 100644 classes/Commands/EditedchannelpostCommand.php delete mode 100644 classes/Commands/GroupchatcreatedCommand.php delete mode 100644 classes/Commands/LeftchatmemberCommand.php delete mode 100644 classes/Commands/MigratefromchatidCommand.php delete mode 100644 classes/Commands/MigratetochatidCommand.php delete mode 100644 classes/Commands/NewchatmembersCommand.php delete mode 100644 classes/Commands/NewchatphotoCommand.php delete mode 100644 classes/Commands/NewchattitleCommand.php diff --git a/bootstrap/bootstrap.php b/bootstrap/bootstrap.php index 40f654b..5e8dfce 100644 --- a/bootstrap/bootstrap.php +++ b/bootstrap/bootstrap.php @@ -667,12 +667,52 @@ public function sendMessageToTelegram($params) erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.make_plain_message', array('msg' => & $params['msg']->msg)); + $keyboardButtons = []; + + $metaMsg = $params['msg']->meta_msg_array; + + if (isset($metaMsg['content']['quick_replies']) && !empty($metaMsg['content']['quick_replies'])) { + foreach ($metaMsg['content']['quick_replies'] as $quickReplyButton) { + if ($quickReplyButton['type'] == 'trigger' || $quickReplyButton['type'] == 'button') { + $keyboardButtons[] = [ + 'text' => $quickReplyButton['content']['name'], + 'callback_data' => ($quickReplyButton['type'] == 'button' ? 'bpayload__||' : 'trigger__||') . $quickReplyButton['content']['payload']. '__' . md5($quickReplyButton['content']['name']) .'__'.$params['msg']->id + ]; + } elseif ($quickReplyButton['type'] == 'url') { + $keyboardButtons[] = [ + 'text' => $quickReplyButton['content']['name'], + 'url' => $quickReplyButton['content']['payload'] + ]; + } + + } + } + $data = [ 'chat_id' => $tChat->tchat_id, - 'text' => trim($params['msg']->msg) . $signatureText, + 'text' => trim($params['msg']->msg) . $signatureText ]; - Longman\TelegramBot\Request::sendMessage($data); + if (!empty($keyboardButtons)) { + $inline_keyboard = new Longman\TelegramBot\Entities\InlineKeyboard($keyboardButtons); + $inline_keyboard->setOneTimeKeyboard(true); + $inline_keyboard->setIsPersistent(false); + $data['reply_markup'] = $inline_keyboard; + } + + $sendData = Longman\TelegramBot\Request::sendMessage($data); + + if ($sendData->isOk()) { + $metaMsg['iwh_msg_id'] = $sendData->getResult()->getMessageId(); + + $params['msg']->meta_msg_array = $metaMsg; + $params['msg']->meta_msg = json_encode($metaMsg); + $params['msg']->del_st = erLhcoreClassModelmsg::STATUS_READ; + + if ($params['msg']->id > 0) { + $params['msg']->updateThis(['update' => ['meta_msg','del_st']]); + } + } } foreach ($images['images'] as $image) { diff --git a/classes/Commands/CallbackqueryCommand.php b/classes/Commands/CallbackqueryCommand.php index 74e0638..cf4941d 100644 --- a/classes/Commands/CallbackqueryCommand.php +++ b/classes/Commands/CallbackqueryCommand.php @@ -13,6 +13,7 @@ use Longman\TelegramBot\Commands\SystemCommand; use Longman\TelegramBot\Request; use Longman\TelegramBot\Entities\InlineKeyboard; +use Longman\TelegramBot\Entities\ServerResponse; /** * Callback query command @@ -44,7 +45,7 @@ class CallbackqueryCommand extends SystemCommand * @return \Longman\TelegramBot\Entities\ServerResponse * @throws \Longman\TelegramBot\Exception\TelegramException */ - public function execute() + public function execute(): ServerResponse { $callback_query = $this->getCallbackQuery(); $callback_query_id = $callback_query->getId(); @@ -389,6 +390,37 @@ public function execute() Request::sendMessage($data); } + } elseif ($paramsCallback[0] == 'bpayload__' || $paramsCallback[0] == 'trigger__') { + + /*$data = [ + 'callback_query_id' => $callback_query_id, + 'text' => 'Thanks!', + 'show_alert' => $callback_data === 'thumb up', + 'cache_time' => 1, + ]; + + Request::answerCallbackQuery($data);*/ + + $payloadParts = explode('__',$paramsCallback[1]); + + $message = \erLhcoreClassModelmsg::fetch($payloadParts[2]); + + $chat = \erLhcoreClassModelChat::fetch($message->chat_id); + + \Longman\TelegramBot\Commands\SystemCommands\GenericmessageCommand::sendBotResponse($chat, $message, array( + 'type' => ($paramsCallback[0] == 'bpayload__' ? 'payload' : 'trigger'), + 'payload' => $payloadParts[0] . '__' . $payloadParts[1], + 'msg_last_id' => $chat->last_msg_id // Message visitor is clicking is not necessary the last message + )); + + return Request::send('editMessageReplyMarkup',[ + 'chat_id' => $callback_query->getFrom()->getId(), + 'message_id' => $message->meta_msg_array['iwh_msg_id'], + 'reply_markup' => null + ]); + + return Request::emptyResponse(); + } else { $data = [ 'callback_query_id' => $callback_query_id, diff --git a/classes/Commands/ChangeownerCommand.php b/classes/Commands/ChangeownerCommand.php index ec5f7b1..f65c947 100644 --- a/classes/Commands/ChangeownerCommand.php +++ b/classes/Commands/ChangeownerCommand.php @@ -14,7 +14,7 @@ use Longman\TelegramBot\Request; use Longman\TelegramBot\Entities\InlineKeyboard; use Longman\TelegramBot\Entities\InlineKeyboardButton; - +use Longman\TelegramBot\Entities\ServerResponse; /** * User "/register" command * @@ -48,7 +48,7 @@ class ChangeownerCommand extends UserCommand * @return \Longman\TelegramBot\Entities\ServerResponse * @throws \Longman\TelegramBot\Exception\TelegramException */ - public function execute() + public function execute(): ServerResponse { $message = $this->getMessage(); @@ -157,8 +157,6 @@ public function execute() 'text' => 'Chat was transferred to:' . PHP_EOL . (string)$operatorDestination->name_official, ]; - Request::sendMessage($data); - $transferLegacy = \erLhcoreClassTransfer::getTransferByChat($chat->id); if (is_array($transferLegacy)) { @@ -177,7 +175,7 @@ public function execute() \erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chat_owner_changed', array('chat' => & $chat, 'user' => $operatorDestination)); - return ; + return Request::sendMessage($data); } $onlineOperators = \erLhcoreClassModelUser::getUserList(); diff --git a/classes/Commands/ChannelchatcreatedCommand.php b/classes/Commands/ChannelchatcreatedCommand.php deleted file mode 100644 index 8c07884..0000000 --- a/classes/Commands/ChannelchatcreatedCommand.php +++ /dev/null @@ -1,50 +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; - -/** - * Channel chat created command - * - * Gets executed when a new channel gets created. - */ -class ChannelchatcreatedCommand extends SystemCommand -{ - /** - * @var string - */ - protected $name = 'channelchatcreated'; - - /** - * @var string - */ - protected $description = 'Channel chat created'; - - /** - * @var string - */ - protected $version = '1.1.0'; - - /** - * Command execute method - * - * @return \Longman\TelegramBot\Entities\ServerResponse - * @throws \Longman\TelegramBot\Exception\TelegramException - */ - public function execute() - { - //$message = $this->getMessage(); - //$channel_chat_created = $message->getChannelChatCreated(); - - return parent::execute(); - } -} diff --git a/classes/Commands/ChannelpostCommand.php b/classes/Commands/ChannelpostCommand.php deleted file mode 100644 index 10ed436..0000000 --- a/classes/Commands/ChannelpostCommand.php +++ /dev/null @@ -1,49 +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; - -/** - * Channel post command - * - * Gets executed when a new post is created in a channel. - */ -class ChannelpostCommand extends SystemCommand -{ - /** - * @var string - */ - protected $name = 'channelpost'; - - /** - * @var string - */ - protected $description = 'Handle channel post'; - - /** - * @var string - */ - protected $version = '1.0.0'; - - /** - * Command execute method - * - * @return \Longman\TelegramBot\Entities\ServerResponse - * @throws \Longman\TelegramBot\Exception\TelegramException - */ - public function execute() - { - //$channel_post = $this->getUpdate()->getChannelPost(); - - return parent::execute(); - } -} diff --git a/classes/Commands/ChatCommand.php b/classes/Commands/ChatCommand.php index 0624f88..2e93c32 100644 --- a/classes/Commands/ChatCommand.php +++ b/classes/Commands/ChatCommand.php @@ -14,6 +14,8 @@ use Longman\TelegramBot\Request; use Longman\TelegramBot\Entities\InlineKeyboard; use Longman\TelegramBot\Entities\InlineKeyboardButton; +use Longman\TelegramBot\Entities\ServerResponse; + /** * User "/register" command @@ -48,7 +50,7 @@ class ChatCommand extends UserCommand * @return \Longman\TelegramBot\Entities\ServerResponse * @throws \Longman\TelegramBot\Exception\TelegramException */ - public function execute() + public function execute(): ServerResponse { $message = $this->getMessage(); $chat_id = $message->getChat()->getId(); diff --git a/classes/Commands/ChatsCommand.php b/classes/Commands/ChatsCommand.php index 43cdafd..1f22500 100644 --- a/classes/Commands/ChatsCommand.php +++ b/classes/Commands/ChatsCommand.php @@ -11,10 +11,26 @@ namespace Longman\TelegramBot\Commands\UserCommands; use Longman\TelegramBot\Commands\UserCommand; -use Longman\TelegramBot\Request; use Longman\TelegramBot\Entities\InlineKeyboard; use Longman\TelegramBot\Entities\InlineKeyboardButton; +use Longman\TelegramBot\DB; +use Longman\TelegramBot\Entities\CallbackQuery; +use Longman\TelegramBot\Entities\ChatJoinRequest; +use Longman\TelegramBot\Entities\ChatMemberUpdated; +use Longman\TelegramBot\Entities\ChosenInlineResult; +use Longman\TelegramBot\Entities\InlineQuery; +use Longman\TelegramBot\Entities\Message; +use Longman\TelegramBot\Entities\Payments\PreCheckoutQuery; +use Longman\TelegramBot\Entities\Payments\ShippingQuery; +use Longman\TelegramBot\Entities\Poll; +use Longman\TelegramBot\Entities\PollAnswer; +use Longman\TelegramBot\Entities\ServerResponse; +use Longman\TelegramBot\Entities\Update; +use Longman\TelegramBot\Exception\TelegramException; +use Longman\TelegramBot\Request; +use Longman\TelegramBot\Telegram; + /** * User "/register" command * @@ -48,7 +64,7 @@ class ChatsCommand extends UserCommand * @return \Longman\TelegramBot\Entities\ServerResponse * @throws \Longman\TelegramBot\Exception\TelegramException */ - public function execute() + public function execute(): ServerResponse { $message = $this->getMessage(); $chat_id = $message->getChat()->getId(); diff --git a/classes/Commands/ChoseninlineresultCommand.php b/classes/Commands/ChoseninlineresultCommand.php deleted file mode 100644 index b1d5cdf..0000000 --- a/classes/Commands/ChoseninlineresultCommand.php +++ /dev/null @@ -1,51 +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; - -/** - * Chosen inline result command - * - * Gets executed when an item from an inline query is selected. - */ -class ChoseninlineresultCommand extends SystemCommand -{ - /** - * @var string - */ - protected $name = 'choseninlineresult'; - - /** - * @var string - */ - protected $description = 'Chosen result query'; - - /** - * @var string - */ - protected $version = '1.1.1'; - - /** - * Command execute method - * - * @return \Longman\TelegramBot\Entities\ServerResponse - * @throws \Longman\TelegramBot\Exception\TelegramException - */ - public function execute() - { - //Information about chosen result is returned - //$inline_query = $this->getChosenInlineResult(); - //$query = $inline_query->getQuery(); - - return parent::execute(); - } -} diff --git a/classes/Commands/DeletechatphotoCommand.php b/classes/Commands/DeletechatphotoCommand.php deleted file mode 100644 index f910715..0000000 --- a/classes/Commands/DeletechatphotoCommand.php +++ /dev/null @@ -1,50 +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; - -/** - * Delete chat photo command - * - * Gets executed when the photo of a group or channel gets deleted. - */ -class DeletechatphotoCommand extends SystemCommand -{ - /** - * @var string - */ - protected $name = 'deletechatphoto'; - - /** - * @var string - */ - protected $description = 'Delete chat photo'; - - /** - * @var string - */ - protected $version = '1.1.0'; - - /** - * Command execute method - * - * @return \Longman\TelegramBot\Entities\ServerResponse - * @throws \Longman\TelegramBot\Exception\TelegramException - */ - public function execute() - { - //$message = $this->getMessage(); - //$delete_chat_photo = $message->getDeleteChatPhoto(); - - return parent::execute(); - } -} diff --git a/classes/Commands/EditedchannelpostCommand.php b/classes/Commands/EditedchannelpostCommand.php deleted file mode 100644 index a85a050..0000000 --- a/classes/Commands/EditedchannelpostCommand.php +++ /dev/null @@ -1,49 +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; - -/** - * Edited channel post command - * - * Gets executed when a post in a channel is edited. - */ -class EditedchannelpostCommand extends SystemCommand -{ - /** - * @var string - */ - protected $name = 'editedchannelpost'; - - /** - * @var string - */ - protected $description = 'Handle edited channel post'; - - /** - * @var string - */ - protected $version = '1.0.0'; - - /** - * Command execute method - * - * @return \Longman\TelegramBot\Entities\ServerResponse - * @throws \Longman\TelegramBot\Exception\TelegramException - */ - public function execute() - { - //$edited_channel_post = $this->getUpdate()->getEditedChannelPost(); - - return parent::execute(); - } -} diff --git a/classes/Commands/EndchatCommand.php b/classes/Commands/EndchatCommand.php index 79ccc06..677adb8 100644 --- a/classes/Commands/EndchatCommand.php +++ b/classes/Commands/EndchatCommand.php @@ -12,6 +12,7 @@ use Longman\TelegramBot\Commands\UserCommand; use Longman\TelegramBot\Request; +use Longman\TelegramBot\Entities\ServerResponse; /** * User "/register" command @@ -46,7 +47,7 @@ class EndchatCommand extends UserCommand * @return \Longman\TelegramBot\Entities\ServerResponse * @throws \Longman\TelegramBot\Exception\TelegramException */ - public function execute() + public function execute(): ServerResponse { $message = $this->getMessage(); $chat_id = $message->getChat()->getId(); diff --git a/classes/Commands/GenericCommand.php b/classes/Commands/GenericCommand.php index d99ed70..4bb7ba5 100644 --- a/classes/Commands/GenericCommand.php +++ b/classes/Commands/GenericCommand.php @@ -12,6 +12,7 @@ use Longman\TelegramBot\Commands\SystemCommand; use Longman\TelegramBot\Request; +use Longman\TelegramBot\Entities\ServerResponse; /** * Generic command @@ -41,12 +42,12 @@ class GenericCommand extends SystemCommand * @return \Longman\TelegramBot\Entities\ServerResponse * @throws \Longman\TelegramBot\Exception\TelegramException */ - public function execute() + public function execute(): ServerResponse { $message = $this->getMessage(); if ($message === null) { - return ; + exit; } //You can use $command as param diff --git a/classes/Commands/GenericmessageCommand.php b/classes/Commands/GenericmessageCommand.php index 7843e45..ae663bc 100644 --- a/classes/Commands/GenericmessageCommand.php +++ b/classes/Commands/GenericmessageCommand.php @@ -14,6 +14,7 @@ use Longman\TelegramBot\Conversation; use Longman\TelegramBot\Request; use GuzzleHttp\Client; +use Longman\TelegramBot\Entities\ServerResponse; /** * Generic message command @@ -48,7 +49,7 @@ class GenericmessageCommand extends SystemCommand * @return \Longman\TelegramBot\Entities\ServerResponse * @throws \Longman\TelegramBot\Exception\TelegramException */ - public function executeNoDb() + public function executeNoDb(): ServerResponse { // Do nothing return Request::emptyResponse(); @@ -172,7 +173,7 @@ private function processVoice($fileId, $chat, $tBot) { * @return \Longman\TelegramBot\Entities\ServerResponse * @throws \Longman\TelegramBot\Exception\TelegramException */ - public function execute() + public function execute(): ServerResponse { $message = $this->getMessage(); @@ -420,8 +421,6 @@ public function execute() $pnd_time = time(); } - - $stmt = $db->prepare('UPDATE lh_chat SET last_user_msg_time = :last_user_msg_time, last_msg_id = :last_msg_id, has_unread_messages = :has_unread_messages, user_id = :user_id, pnd_time = :pnd_time, status = :status, status_sub_sub = :status_sub_sub WHERE id = :id'); $stmt->bindValue(':id', $chat->id, \PDO::PARAM_INT); $stmt->bindValue(':last_user_msg_time', $msg->time, \PDO::PARAM_INT); @@ -443,9 +442,15 @@ public function execute() $tChat->utime = time(); $tChat->saveThis(); + if (!isset($_SERVER['HTTP_USER_AGENT'])) { + $_SERVER['HTTP_USER_AGENT'] = 'API, Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36'; + } + + self::assignOnlineVisitor($chat, $tChat); + $db->commit(); - $this->sendBotResponse($chat, $msg); + self::sendBotResponse($chat, $msg); // Standard event on unread chat messages if ($chat->has_unread_messages == 1 && $chat->last_user_msg_time < (time() - 5)) { @@ -618,9 +623,15 @@ public function execute() $chat->saveThis(); + if (!isset($_SERVER['HTTP_USER_AGENT'])) { + $_SERVER['HTTP_USER_AGENT'] = 'API, Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36'; + } + + self::assignOnlineVisitor($chat, $tChat); + if ($tBot->bot_disabled == 0) { \erLhcoreClassChatValidator::setBot($chat, array('msg' => $msg)); - $this->sendBotResponse($chat, $msg, array('init' => true)); + self::sendBotResponse($chat, $msg, array('init' => true)); } /** @@ -645,23 +656,68 @@ public function execute() return Request::emptyResponse(); } - public function sendBotResponse($chat, $msg, $params = array()) { + public static function assignOnlineVisitor(& $chat, $tChat) + { + if ($chat->online_user_id == 0 && \erLhcoreClassModelChatConfig::fetch('track_online_visitors')->current_value == 1) { + $vid = md5($tChat->bot_id . '_' . $tChat->tchat_id); + $userInstance = \erLhcoreClassModelChatOnlineUser::handleRequest(array( + 'pages_count' => true, + 'message_seen_timeout' => \erLhcoreClassModelChatConfig::fetch('message_seen_timeout')->current_value, + 'vid' => $vid)); + + $userInstance->chat_id = $chat->id; + $userInstance->dep_id = $chat->dep_id; + + if ($userInstance->visitor_tz == '') { + $userInstance->visitor_tz = $chat->user_tz_identifier; + } + + $userInstance->updateThis(['update' => ['chat_id','dep_id','visitor_tz']]); + + $chat->online_user_id = $userInstance->id; + $chat->updateThis(['update' => ['online_user_id']]); + } + } + + public static function sendBotResponse($chat, $msg, $params = array()) { + if ($chat->gbot_id > 0 && (!isset($chat->chat_variables_array['gbot_disabled']) || $chat->chat_variables_array['gbot_disabled'] == 0)) { $chat->refreshThis(); + $lastMessageIdNew = $lastMessageId = $chat->last_msg_id; + if (!isset($params['init']) || $params['init'] == false) { - \erLhcoreClassGenericBotWorkflow::userMessageAdded($chat, $msg); + if (isset($params['type']) && $params['type'] == 'payload' && $msg instanceof \erLhcoreClassModelmsg) { + \erLhcoreClassGenericBotWorkflow::processButtonClick($chat, $msg, $params['payload'], array('processed' => false)); + } else if (isset($params['type']) && $params['type'] == 'trigger' && $msg instanceof \erLhcoreClassModelmsg) { + \erLhcoreClassGenericBotWorkflow::processTriggerClick($chat, $msg, $params['payload'], array('processed' => false)); + } else { + \erLhcoreClassGenericBotWorkflow::userMessageAdded($chat, $msg); + } + } + + if (!isset($params['msg_last_id'])) { + $params['msg_last_id'] = $msg->id; } // Find a new messages - $botMessages = \erLhcoreClassModelmsg::getList(array('filter' => array('user_id' => -2, 'chat_id' => $chat->id), 'filtergt' => array('id' => $msg->id))); + $botMessages = \erLhcoreClassModelmsg::getList(array('filter' => array('user_id' => -2, 'chat_id' => $chat->id), 'filtergt' => array('id' => $params['msg_last_id']))); foreach ($botMessages as $botMessage) { + + $lastMessageIdNew = $botMessage->id; + \erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.web_add_msg_admin', array( 'chat' => & $chat, 'msg' => $botMessage )); } + + if ($lastMessageId < $lastMessageIdNew) { + $chat->last_msg_id = $lastMessageIdNew; + $chat->updateThis(['update' => ['last_msg_id']]); + } } + } } diff --git a/classes/Commands/GroupchatcreatedCommand.php b/classes/Commands/GroupchatcreatedCommand.php deleted file mode 100644 index cbe3ed2..0000000 --- a/classes/Commands/GroupchatcreatedCommand.php +++ /dev/null @@ -1,50 +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; - -/** - * Group chat created command - * - * Gets executed when a group chat is created. - */ -class GroupchatcreatedCommand extends SystemCommand -{ - /** - * @var string - */ - protected $name = 'groupchatcreated'; - - /** - * @var string - */ - protected $description = 'Group chat created'; - - /** - * @var string - */ - protected $version = '1.1.0'; - - /** - * Command execute method - * - * @return \Longman\TelegramBot\Entities\ServerResponse - * @throws \Longman\TelegramBot\Exception\TelegramException - */ - public function execute() - { - //$message = $this->getMessage(); - //$group_chat_created = $message->getGroupChatCreated(); - - return parent::execute(); - } -} diff --git a/classes/Commands/HelpCommand.php b/classes/Commands/HelpCommand.php index 49de6e1..38b6e35 100644 --- a/classes/Commands/HelpCommand.php +++ b/classes/Commands/HelpCommand.php @@ -13,6 +13,7 @@ use Longman\TelegramBot\Commands\Command; use Longman\TelegramBot\Commands\UserCommand; use Longman\TelegramBot\Request; +use Longman\TelegramBot\Entities\ServerResponse; /** * User "/help" command @@ -44,7 +45,7 @@ class HelpCommand extends UserCommand /** * @inheritdoc */ - public function execute() + public function execute(): ServerResponse { $message = $this->getMessage(); $chat_id = $message->getChat()->getId(); diff --git a/classes/Commands/InlinequeryCommand.php b/classes/Commands/InlinequeryCommand.php index 654e74f..7f1f6b4 100644 --- a/classes/Commands/InlinequeryCommand.php +++ b/classes/Commands/InlinequeryCommand.php @@ -14,6 +14,7 @@ use Longman\TelegramBot\Entities\InlineQuery\InlineQueryResultArticle; use Longman\TelegramBot\Entities\InputMessageContent\InputTextMessageContent; use Longman\TelegramBot\Request; +use Longman\TelegramBot\Entities\ServerResponse; /** * Inline query command @@ -43,7 +44,7 @@ class InlinequeryCommand extends SystemCommand * @return \Longman\TelegramBot\Entities\ServerResponse * @throws \Longman\TelegramBot\Exception\TelegramException */ - public function execute() + public function execute(): ServerResponse { $inline_query = $this->getInlineQuery(); $query = $inline_query->getQuery(); diff --git a/classes/Commands/LeftchatmemberCommand.php b/classes/Commands/LeftchatmemberCommand.php deleted file mode 100644 index 5062d58..0000000 --- a/classes/Commands/LeftchatmemberCommand.php +++ /dev/null @@ -1,50 +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; - -/** - * Left chat member command - * - * Gets executed when a member leaves the chat. - */ -class LeftchatmemberCommand extends SystemCommand -{ - /** - * @var string - */ - protected $name = 'leftchatmember'; - - /** - * @var string - */ - protected $description = 'Left Chat Member'; - - /** - * @var string - */ - protected $version = '1.1.0'; - - /** - * Command execute method - * - * @return \Longman\TelegramBot\Entities\ServerResponse - * @throws \Longman\TelegramBot\Exception\TelegramException - */ - public function execute() - { - //$message = $this->getMessage(); - //$member = $message->getLeftChatMember(); - - return parent::execute(); - } -} diff --git a/classes/Commands/MigratefromchatidCommand.php b/classes/Commands/MigratefromchatidCommand.php deleted file mode 100644 index 9ee043a..0000000 --- a/classes/Commands/MigratefromchatidCommand.php +++ /dev/null @@ -1,50 +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; - -/** - * Migrate from chat id command - * - * Gets executed when a chat gets migrated. - */ -class MigratefromchatidCommand extends SystemCommand -{ - /** - * @var string - */ - protected $name = 'migratefromchatid'; - - /** - * @var string - */ - protected $description = 'Migrate from chat id'; - - /** - * @var string - */ - protected $version = '1.1.0'; - - /** - * Command execute method - * - * @return \Longman\TelegramBot\Entities\ServerResponse - * @throws \Longman\TelegramBot\Exception\TelegramException - */ - public function execute() - { - //$message = $this->getMessage(); - //$migrate_from_chat_id = $message->getMigrateFromChatId(); - - return parent::execute(); - } -} diff --git a/classes/Commands/MigratetochatidCommand.php b/classes/Commands/MigratetochatidCommand.php deleted file mode 100644 index cf91478..0000000 --- a/classes/Commands/MigratetochatidCommand.php +++ /dev/null @@ -1,50 +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; - -/** - * Migrate to chat id command - * - * Gets executed when a chat gets migrated. - */ -class MigratetochatidCommand extends SystemCommand -{ - /** - * @var string - */ - protected $name = 'migratetochatid'; - - /** - * @var string - */ - protected $description = 'Migrate to chat id'; - - /** - * @var string - */ - protected $version = '1.1.0'; - - /** - * Command execute method - * - * @return \Longman\TelegramBot\Entities\ServerResponse - * @throws \Longman\TelegramBot\Exception\TelegramException - */ - public function execute() - { - //$message = $this->getMessage(); - //$migrate_to_chat_id = $message->getMigrateToChatId(); - - return parent::execute(); - } -} diff --git a/classes/Commands/NewchatmembersCommand.php b/classes/Commands/NewchatmembersCommand.php deleted file mode 100644 index a5f2e13..0000000 --- a/classes/Commands/NewchatmembersCommand.php +++ /dev/null @@ -1,66 +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; - -/** - * New chat member command - */ -class NewchatmembersCommand extends SystemCommand -{ - /** - * @var string - */ - protected $name = 'newchatmembers'; - - /** - * @var string - */ - protected $description = 'New Chat Members'; - - /** - * @var string - */ - protected $version = '1.2.0'; - - /** - * Command execute method - * - * @return \Longman\TelegramBot\Entities\ServerResponse - * @throws \Longman\TelegramBot\Exception\TelegramException - */ - public function execute() - { - $message = $this->getMessage(); - - $chat_id = $message->getChat()->getId(); - $members = $message->getNewChatMembers(); - - $text = 'Hi there!'; - - if (!$message->botAddedInChat()) { - $member_names = []; - foreach ($members as $member) { - $member_names[] = $member->tryMention(); - } - $text = 'Hi ' . implode(', ', $member_names) . '!'; - } - - $data = [ - 'chat_id' => $chat_id, - 'text' => $text, - ]; - - return Request::sendMessage($data); - } -} diff --git a/classes/Commands/NewchatphotoCommand.php b/classes/Commands/NewchatphotoCommand.php deleted file mode 100644 index 31381fc..0000000 --- a/classes/Commands/NewchatphotoCommand.php +++ /dev/null @@ -1,50 +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; - -/** - * New chat photo command - * - * Gets executed when the photo of a group or channel gets set. - */ -class NewchatphotoCommand extends SystemCommand -{ - /** - * @var string - */ - protected $name = 'newchatphoto'; - - /** - * @var string - */ - protected $description = 'New chat Photo'; - - /** - * @var string - */ - protected $version = '1.1.0'; - - /** - * Command execute method - * - * @return \Longman\TelegramBot\Entities\ServerResponse - * @throws \Longman\TelegramBot\Exception\TelegramException - */ - public function execute() - { - //$message = $this->getMessage(); - //$new_chat_photo = $message->getNewChatPhoto(); - - return parent::execute(); - } -} diff --git a/classes/Commands/NewchattitleCommand.php b/classes/Commands/NewchattitleCommand.php deleted file mode 100644 index 0855669..0000000 --- a/classes/Commands/NewchattitleCommand.php +++ /dev/null @@ -1,50 +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; - -/** - * New chat title command - * - * Gets executed when the title of a group or channel gets set. - */ -class NewchattitleCommand extends SystemCommand -{ - /** - * @var string - */ - protected $name = 'newchattitle'; - - /** - * @var string - */ - protected $description = 'New chat Title'; - - /** - * @var string - */ - protected $version = '1.1.0'; - - /** - * Command execute method - * - * @return \Longman\TelegramBot\Entities\ServerResponse - * @throws \Longman\TelegramBot\Exception\TelegramException - */ - public function execute() - { - //$message = $this->getMessage(); - //$new_chat_title = $message->getNewChatTitle(); - - return parent::execute(); - } -} diff --git a/classes/Commands/PinnedmessageCommand.php b/classes/Commands/PinnedmessageCommand.php index a5a7f2b..f0d55e3 100644 --- a/classes/Commands/PinnedmessageCommand.php +++ b/classes/Commands/PinnedmessageCommand.php @@ -11,7 +11,7 @@ namespace Longman\TelegramBot\Commands\SystemCommands; use Longman\TelegramBot\Commands\SystemCommand; - +use Longman\TelegramBot\Entities\ServerResponse; /** * Pinned message command * @@ -40,7 +40,7 @@ class PinnedmessageCommand extends SystemCommand * @return \Longman\TelegramBot\Entities\ServerResponse * @throws \Longman\TelegramBot\Exception\TelegramException */ - public function execute() + public function execute(): ServerResponse { //$message = $this->getMessage(); //$pinned_message = $message->getPinnedMessage(); diff --git a/classes/Commands/RegisterCommand.php b/classes/Commands/RegisterCommand.php index a3b66ef..6180687 100644 --- a/classes/Commands/RegisterCommand.php +++ b/classes/Commands/RegisterCommand.php @@ -12,7 +12,7 @@ use Longman\TelegramBot\Commands\UserCommand; use Longman\TelegramBot\Request; - +use Longman\TelegramBot\Entities\ServerResponse; /** * User "/register" command * @@ -46,7 +46,7 @@ class RegisterCommand extends UserCommand * @return \Longman\TelegramBot\Entities\ServerResponse * @throws \Longman\TelegramBot\Exception\TelegramException */ - public function execute() + public function execute(): ServerResponse { $message = $this->getMessage(); $chat_id = $message->getChat()->getId(); diff --git a/classes/Commands/StartCommand.php b/classes/Commands/StartCommand.php index 1ddc043..c72c937 100644 --- a/classes/Commands/StartCommand.php +++ b/classes/Commands/StartCommand.php @@ -12,6 +12,7 @@ use Longman\TelegramBot\Commands\SystemCommand; use Longman\TelegramBot\Request; +use Longman\TelegramBot\Entities\ServerResponse; /** * Start command @@ -51,7 +52,7 @@ class StartCommand extends SystemCommand * @return \Longman\TelegramBot\Entities\ServerResponse * @throws \Longman\TelegramBot\Exception\TelegramException */ - public function execute() + public function execute(): ServerResponse { $telegramExt = \erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionLhctelegram'); $tBot = $telegramExt->getBot(); diff --git a/classes/Commands/SupergroupchatcreatedCommand.php b/classes/Commands/SupergroupchatcreatedCommand.php index a84661a..3f0cb02 100644 --- a/classes/Commands/SupergroupchatcreatedCommand.php +++ b/classes/Commands/SupergroupchatcreatedCommand.php @@ -11,6 +11,7 @@ namespace Longman\TelegramBot\Commands\SystemCommands; use Longman\TelegramBot\Commands\SystemCommand; +use Longman\TelegramBot\Entities\ServerResponse; /** * Super group chat created command @@ -40,7 +41,7 @@ class SupergroupchatcreatedCommand extends SystemCommand * @return \Longman\TelegramBot\Entities\ServerResponse * @throws \Longman\TelegramBot\Exception\TelegramException */ - public function execute() + public function execute(): ServerResponse { //$message = $this->getMessage(); //$supergroup_chat_created = $message->getSuperGroupChatCreated(); diff --git a/classes/Commands/WhoamiCommand.php b/classes/Commands/WhoamiCommand.php index 0704ec9..caa8c65 100644 --- a/classes/Commands/WhoamiCommand.php +++ b/classes/Commands/WhoamiCommand.php @@ -18,6 +18,7 @@ use Longman\TelegramBot\Entities\UserProfilePhotos; use Longman\TelegramBot\Request; use Longman\TelegramBot\Entities\InlineKeyboard; +use Longman\TelegramBot\Entities\ServerResponse; /** * User "/whoami" command @@ -57,7 +58,7 @@ class WhoamiCommand extends UserCommand * @return \Longman\TelegramBot\Entities\ServerResponse * @throws \Longman\TelegramBot\Exception\TelegramException */ - public function execute() + public function execute(): ServerResponse { $message = $this->getMessage(); diff --git a/composer.json b/composer.json index 8da251c..4e229ff 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "email": "remdex@mgmail.com" }, "require": { - "longman/telegram-bot": "dev-master#54823db1306a791830a7915072f03ff84fd7c4f3" + "longman/telegram-bot": "dev-master#e80416306f6cd054fd6b5e3a947528e18bdbf518" }, "minimum-stability": "dev", "config": { diff --git a/composer.lock b/composer.lock index c0fd4ae..0c2af7f 100644 --- a/composer.lock +++ b/composer.lock @@ -1,185 +1,305 @@ { "_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", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6bc3cf09482acbd6647093a046f53fd8", + "content-hash": "5a140fc1a72d319c64bc9eca06193c22", "packages": [ { "name": "guzzlehttp/guzzle", - "version": "6.5.x-dev", + "version": "7.9.x-dev", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "aab4ebd862aa7d04f01a4b51849d657db56d882e" + "reference": "d95d9ab74822c2ca06b31477cd6775a4a299b8e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/aab4ebd862aa7d04f01a4b51849d657db56d882e", - "reference": "aab4ebd862aa7d04f01a4b51849d657db56d882e", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d95d9ab74822c2ca06b31477cd6775a4a299b8e8", + "reference": "d95d9ab74822c2ca06b31477cd6775a4a299b8e8", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.6.1", - "php": ">=5.5", - "symfony/polyfill-intl-idn": "^1.11" + "guzzlehttp/promises": "^1.5.3 || ^2.0.1", + "guzzlehttp/psr7": "^1.9.1 || ^2.5.1", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" }, "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.1", "ext-curl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", - "psr/log": "^1.1" + "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.29 || ^9.5.23", + "psr/log": "^1.1 || ^2.0 || ^3.0" }, "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": "6.5-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" } ], "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" ], - "time": "2020-04-18 10:38:46" + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.8" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2023-09-11T09:12:01+00:00" }, { "name": "guzzlehttp/promises", - "version": "dev-master", + "version": "2.0.x-dev", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "89b1a76b7fda5853401297dc4b2a093cba1fda23" + "reference": "71b12f952d8be69a239989db2fe08314a5189e3b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/89b1a76b7fda5853401297dc4b2a093cba1fda23", - "reference": "89b1a76b7fda5853401297dc4b2a093cba1fda23", + "url": "https://api.github.com/repos/guzzle/promises/zipball/71b12f952d8be69a239989db2fe08314a5189e3b", + "reference": "71b12f952d8be69a239989db2fe08314a5189e3b", "shasum": "" }, "require": { - "php": ">=5.6" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^5.7.27 || ^7.5" + "bamarni/composer-bin-plugin": "^1.8.1", + "phpunit/phpunit": "^8.5.29 || ^9.5.23" }, + "default-branch": true, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.4-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "autoload": { "psr-4": { "GuzzleHttp\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" } ], "description": "Guzzle promises library", "keywords": [ "promise" ], - "time": "2020-02-15 23:33:03" + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/2.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2023-08-27T10:15:36+00:00" }, { "name": "guzzlehttp/psr7", - "version": "1.x-dev", + "version": "2.6.x-dev", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "c73b502efd02beb2602500aa36793fb405e383ac" + "reference": "38ef514a6c21335f29d9be64b097d2582ecbf8e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/c73b502efd02beb2602500aa36793fb405e383ac", - "reference": "c73b502efd02beb2602500aa36793fb405e383ac", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/38ef514a6c21335f29d9be64b097d2582ecbf8e4", + "reference": "38ef514a6c21335f29d9be64b097d2582ecbf8e4", "shasum": "" }, "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0", + "ralouphie/getallheaders": "^3.0" }, "provide": { + "psr/http-factory-implementation": "1.0", "psr/http-message-implementation": "1.0" }, "require-dev": { - "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + "bamarni/composer-bin-plugin": "^1.8.1", + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^8.5.29 || ^9.5.23" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, + "default-branch": true, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.6-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "autoload": { "psr-4": { "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, { "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" } ], "description": "PSR-7 message implementation that also provides common utility methods", @@ -193,7 +313,25 @@ "uri", "url" ], - "time": "2020-02-12 23:13:46" + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.6" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2023-09-10T16:11:14+00:00" }, { "name": "longman/telegram-bot", @@ -201,12 +339,12 @@ "source": { "type": "git", "url": "https://github.com/php-telegram-bot/core.git", - "reference": "54823db1306a791830a7915072f03ff84fd7c4f3" + "reference": "e80416306f6cd054fd6b5e3a947528e18bdbf518" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-telegram-bot/core/zipball/54823db1306a791830a7915072f03ff84fd7c4f3", - "reference": "54823db1306a791830a7915072f03ff84fd7c4f3", + "url": "https://api.github.com/repos/php-telegram-bot/core/zipball/e80416306f6cd054fd6b5e3a947528e18bdbf518", + "reference": "e80416306f6cd054fd6b5e3a947528e18bdbf518", "shasum": "" }, "require": { @@ -214,20 +352,25 @@ "ext-json": "*", "ext-mbstring": "*", "ext-pdo": "*", - "guzzlehttp/guzzle": "^6.3", - "php": "^5.5|^7.0", - "psr/log": "^1.1" + "guzzlehttp/guzzle": "^6.0|^7.0", + "php": "^7.3|^8.0", + "psr/log": "^1.1|^2.0|^3.0" }, "require-dev": { - "dms/phpunit-arraysubset-asserts": "^0.1.0", - "monolog/monolog": "^2.0", - "phpunit/phpunit": "^8.4", - "squizlabs/php_codesniffer": "^3.4" + "dms/phpunit-arraysubset-asserts": "^0.2", + "monolog/monolog": "^2.1", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.6" }, "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.81.x-dev" + } + }, "autoload": { "psr-4": { - "Longman\\TelegramBot\\": "src/" + "Longman\\TelegramBot\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -241,6 +384,12 @@ "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", @@ -254,25 +403,61 @@ "bot", "telegram" ], - "time": "2017-10-17 12:09:43" + "support": { + "issues": "https://github.com/php-telegram-bot/core/issues", + "source": "https://github.com/php-telegram-bot/core" + }, + "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": "2023-05-27T15:36:06+00:00" }, { - "name": "psr/http-message", + "name": "psr/http-client", "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "efd67d1dc14a7ef4fc4e518e7dee91c271d524e4" + "url": "https://github.com/php-fig/http-client.git", + "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/efd67d1dc14a7ef4fc4e518e7dee91c271d524e4", - "reference": "efd67d1dc14a7ef4fc4e518e7dee91c271d524e4", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31", + "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { @@ -281,7 +466,7 @@ }, "autoload": { "psr-4": { - "Psr\\Http\\Message\\": "src/" + "Psr\\Http\\Client\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -291,47 +476,50 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", "keywords": [ "http", - "http-message", + "http-client", "psr", - "psr-7", - "request", - "response" + "psr-18" ], - "time": "2019-08-29 13:16:46" + "support": { + "source": "https://github.com/php-fig/http-client/tree/1.0.2" + }, + "time": "2023-04-10T20:12:12+00:00" }, { - "name": "psr/log", + "name": "psr/http-factory", "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + "url": "https://github.com/php-fig/http-factory.git", + "reference": "6d70f402f0eddb2b154b22950b5381bbf5b28469" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/6d70f402f0eddb2b154b22950b5381bbf5b28469", + "reference": "6d70f402f0eddb2b154b22950b5381bbf5b28469", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.0.0", + "psr/http-message": "^1.0 || ^2.0" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Http\\Message\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -341,44 +529,53 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", "keywords": [ - "log", + "factory", + "http", + "message", "psr", - "psr-3" + "psr-17", + "psr-7", + "request", + "response" ], - "time": "2020-03-23 09:12:05" + "support": { + "source": "https://github.com/php-fig/http-factory/tree/master" + }, + "time": "2023-05-17T18:32:11+00:00" }, { - "name": "ralouphie/getallheaders", - "version": "3.0.3", + "name": "psr/http-message", + "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "120b605dfeb996808c31b6477290a714d356e822" + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", - "reference": "120b605dfeb996808c31b6477290a714d356e822", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", "shasum": "" }, "require": { - "php": ">=5.6" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpunit": "^5 || ^6.5" + "php": "^7.2 || ^8.0" }, + "default-branch": true, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { - "files": [ - "src/getallheaders.php" - ] + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -386,48 +583,53 @@ ], "authors": [ { - "name": "Ralph Khattar", - "email": "ralph.khattar@gmail.com" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "A polyfill for getallheaders.", - "time": "2019-03-08T08:55:37+00:00" + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/2.0" + }, + "time": "2023-04-04T09:54:51+00:00" }, { - "name": "symfony/polyfill-intl-idn", + "name": "psr/log", "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf" + "url": "https://github.com/php-fig/log.git", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf", - "reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", "shasum": "" }, "require": { - "php": ">=5.3.3", - "symfony/polyfill-mbstring": "^1.3", - "symfony/polyfill-php72": "^1.10" - }, - "suggest": { - "ext-intl": "For best performance" + "php": ">=8.0.0" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "3.x-dev" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Intl\\Idn\\": "" - }, - "files": [ - "bootstrap.php" - ] + "Psr\\Log\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -435,58 +637,47 @@ ], "authors": [ { - "name": "Laurent Bassin", - "email": "laurent@bassin.info" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", - "homepage": "https://symfony.com", + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ - "compatibility", - "idn", - "intl", - "polyfill", - "portable", - "shim" - ], - "time": "2020-03-09 19:04:49" + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.0" + }, + "time": "2021-07-14T16:46:02+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "dev-master", + "name": "ralouphie/getallheaders", + "version": "3.0.3", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac" + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac", - "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.6" }, - "suggest": { - "ext-mbstring": "For best performance" + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.15-dev" - } - }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ - "bootstrap.php" + "src/getallheaders.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -495,54 +686,48 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" } ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2020-03-09 19:04:49" + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" }, { - "name": "symfony/polyfill-php72", - "version": "dev-master", + "name": "symfony/deprecation-contracts", + "version": "dev-main", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "37b0976c78b94856543260ce09b460a7bc852747" + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/37b0976c78b94856543260ce09b460a7bc852747", - "reference": "37b0976c78b94856543260ce09b460a7bc852747", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=8.1" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-main": "3.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, "files": [ - "bootstrap.php" + "function.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -559,15 +744,26 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } ], - "time": "2020-02-27 09:26:54" + "time": "2023-05-23T14:45:45+00:00" } ], "packages-dev": [], @@ -579,5 +775,6 @@ "prefer-stable": false, "prefer-lowest": false, "platform": [], - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "2.3.0" } diff --git a/design/lhctelegramtheme/tpl/lhchat/chat_tabs/information_rows/extension_information_row_multiinclude.tpl.php b/design/lhctelegramtheme/tpl/lhchat/chat_tabs/information_rows/extension_information_row_multiinclude.tpl.php index ce92fb7..50dcec5 100644 --- a/design/lhctelegramtheme/tpl/lhchat/chat_tabs/information_rows/extension_information_row_multiinclude.tpl.php +++ b/design/lhctelegramtheme/tpl/lhchat/chat_tabs/information_rows/extension_information_row_multiinclude.tpl.php @@ -3,7 +3,7 @@ chat_variables_array['tchat']) && $chat->chat_variables_array['tchat'] == true) : ?> -  getTranslation('chat/adminchat','Telegram')?> +  getTranslation('chat/adminchat','Telegram')?> YES diff --git a/doc/install.sql b/doc/install.sql index 98df3df..98c7f1a 100644 --- a/doc/install.sql +++ b/doc/install.sql @@ -1,6 +1,6 @@ -CREATE TABLE `lhc_telegram_chat` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `chat_id` bigint(20) unsigned NOT NULL, `tchat_id` bigint(20) unsigned NOT NULL, `bot_id` int(11) NOT NULL, `ctime` int(11) NOT NULL, `utime` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `tchat_id_utime` (`tchat_id`,`utime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -CREATE TABLE `lhc_telegram_bot` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bot_username` varchar(50) NOT NULL, `bot_disabled` tinyint(1) unsigned NOT NULL, `bot_api` varchar(50) NOT NULL, `dep_id` int(11) unsigned NOT NULL, `bot_client` int(11) unsigned NOT NULL, `webhook_set` int(11) unsigned NOT NULL, `chat_timeout` int(11) unsigned NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -CREATE TABLE `lhc_telegram_signature` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bot_id` int(11) unsigned NOT NULL, `user_id` int(11) unsigned NOT NULL, `signature` text NOT NULL, PRIMARY KEY (`id`), KEY `bot_id_user_id` (`bot_id`,`user_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -CREATE TABLE `lhc_telegram_operator` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bot_id` int(11) unsigned NOT NULL, `chat_id` bigint(20) unsigned NOT NULL,`tchat_id` bigint(20) unsigned NOT NULL, `tuser_id` bigint(20) unsigned NOT NULL, `user_id` bigint(20) unsigned NOT NULL ,`confirmed` tinyint(1) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `bot_id` (`bot_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -CREATE TABLE `lhc_telegram_bot_dep` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bot_id` int(11) unsigned NOT NULL, `dep_id` int(11) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `bot_id` (`bot_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -CREATE TABLE `lhc_telegram_lead` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `tchat_id` int(11) unsigned NOT NULL, `dep_id` int(11) unsigned NOT NULL, `tbot_id` int(11) unsigned NOT NULL, `utime` int(11) unsigned NOT NULL, `ctime` int(11) unsigned NOT NULL, `first_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `last_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `username` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `language_code` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `tchat_id` (`tchat_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file +CREATE TABLE `lhc_telegram_chat` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `chat_id` bigint(20) unsigned NOT NULL, `tchat_id` bigint(20) unsigned NOT NULL, `bot_id` bigint(20) NOT NULL, `ctime` bigint(20) NOT NULL, `utime` bigint(20) NOT NULL, PRIMARY KEY (`id`), KEY `tchat_id_utime` (`tchat_id`,`utime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +CREATE TABLE `lhc_telegram_bot` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bot_username` varchar(50) NOT NULL, `bot_disabled` tinyint(1) unsigned NOT NULL, `bot_api` varchar(50) NOT NULL, `dep_id` bigint(20) unsigned NOT NULL, `bot_client` bigint(20) unsigned NOT NULL, `webhook_set` bigint(20) unsigned NOT NULL, `chat_timeout` bigint(20) unsigned NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +CREATE TABLE `lhc_telegram_signature` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bot_id` bigint(20) unsigned NOT NULL, `user_id` bigint(20) unsigned NOT NULL, `signature` text NOT NULL, PRIMARY KEY (`id`), KEY `bot_id_user_id` (`bot_id`,`user_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +CREATE TABLE `lhc_telegram_operator` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bot_id` bigint(20) unsigned NOT NULL, `chat_id` bigint(20) unsigned NOT NULL,`tchat_id` bigint(20) unsigned NOT NULL, `tuser_id` bigint(20) unsigned NOT NULL, `user_id` bigint(20) unsigned NOT NULL ,`confirmed` tinyint(1) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `bot_id` (`bot_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +CREATE TABLE `lhc_telegram_bot_dep` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bot_id` bigint(20) unsigned NOT NULL, `dep_id` bigint(20) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `bot_id` (`bot_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +CREATE TABLE `lhc_telegram_lead` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `tchat_id` bigint(20) unsigned NOT NULL, `dep_id` bigint(20) unsigned NOT NULL, `tbot_id` bigint(20) unsigned NOT NULL, `utime` bigint(20) unsigned NOT NULL, `ctime` bigint(20) unsigned NOT NULL, `first_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `last_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `username` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `language_code` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `tchat_id` (`tchat_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; \ No newline at end of file diff --git a/doc/structure.json b/doc/structure.json index 791b2f4..24fa633 100644 --- a/doc/structure.json +++ b/doc/structure.json @@ -27,7 +27,7 @@ }, { "field": "bot_id", - "type": "int(11)", + "type": "bigint(20) unsigned", "null": "NO", "key": "", "default": null, @@ -35,7 +35,7 @@ }, { "field": "ctime", - "type": "int(11)", + "type": "bigint(20) unsigned", "null": "NO", "key": "", "default": null, @@ -43,7 +43,7 @@ }, { "field": "utime", - "type": "int(11)", + "type": "bigint(20) unsigned", "null": "NO", "key": "", "default": null, @@ -61,7 +61,7 @@ }, { "field": "chat_timeout", - "type": "int(11) unsigned", + "type": "bigint(20) unsigned", "null": "NO", "key": "", "default": null, @@ -69,7 +69,7 @@ }, { "field": "dep_id", - "type": "int(11) unsigned", + "type": "bigint(20) unsigned", "null": "NO", "key": "UNI", "default": null, @@ -77,7 +77,7 @@ }, { "field": "bot_disabled", - "type": "tinyint(1) unsigned", + "type": "bigint(20) unsigned", "null": "NO", "key": "UNI", "default": null, @@ -85,7 +85,7 @@ }, { "field": "bot_client", - "type": "int(11) unsigned", + "type": "bigint(20) unsigned", "null": "NO", "key": "UNI", "default": null, @@ -93,7 +93,7 @@ }, { "field": "webhook_set", - "type": "int(11) unsigned", + "type": "bigint(20) unsigned", "null": "NO", "key": "UNI", "default": null, @@ -129,7 +129,7 @@ }, { "field": "bot_id", - "type": "int(11) unsigned", + "type": "bigint(20) unsigned", "null": "NO", "key": "", "default": null, @@ -137,7 +137,7 @@ }, { "field": "user_id", - "type": "int(11) unsigned", + "type": "bigint(20) unsigned", "null": "NO", "key": "UNI", "default": null, @@ -164,7 +164,7 @@ }, { "field": "bot_id", - "type": "int(11) unsigned", + "type": "bigint(20) unsigned", "null": "NO", "key": "", "default": null, @@ -222,7 +222,7 @@ }, { "field": "bot_id", - "type": "int(11) unsigned", + "type": "bigint(20) unsigned", "null": "NO", "key": "", "default": null, @@ -230,7 +230,7 @@ }, { "field": "dep_id", - "type": "int(11) unsigned", + "type": "bigint(20) unsigned", "null": "NO", "key": "UNI", "default": null, @@ -259,12 +259,12 @@ "tables_data_identifier": { }, "tables_indexes" : { }, "tables_create": { - "lhc_telegram_chat" : "CREATE TABLE `lhc_telegram_chat` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `chat_id` bigint(20) unsigned NOT NULL, `tchat_id` bigint(20) unsigned NOT NULL, `bot_id` int(11) NOT NULL, `ctime` int(11) NOT NULL, `utime` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `tchat_id_utime` (`tchat_id`,`utime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", - "lhc_telegram_bot" : "CREATE TABLE `lhc_telegram_bot` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bot_username` varchar(50) NOT NULL, `bot_api` varchar(50) NOT NULL, `bot_disabled` tinyint(1) unsigned NOT NULL, `dep_id` int(11) unsigned NOT NULL, `bot_client` int(11) unsigned NOT NULL, `webhook_set` int(11) unsigned NOT NULL, `chat_timeout` int(11) unsigned NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", - "lhc_telegram_signature" : "CREATE TABLE `lhc_telegram_signature` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bot_id` int(11) unsigned NOT NULL, `user_id` int(11) unsigned NOT NULL, `signature` text NOT NULL, PRIMARY KEY (`id`), KEY `bot_id_user_id` (`bot_id`,`user_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", - "lhc_telegram_operator" : "CREATE TABLE `lhc_telegram_operator` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bot_id` int(11) unsigned NOT NULL, `chat_id` bigint(20) unsigned NOT NULL,`tchat_id` bigint(20) unsigned NOT NULL, `tuser_id` bigint(20) unsigned NOT NULL, `user_id` bigint(20) unsigned NOT NULL ,`confirmed` tinyint(1) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `bot_id` (`bot_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", - "lhc_telegram_bot_dep" : "CREATE TABLE `lhc_telegram_bot_dep` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bot_id` int(11) unsigned NOT NULL, `dep_id` int(11) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `bot_id` (`bot_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", - "lhc_telegram_lead" : "CREATE TABLE `lhc_telegram_lead` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `tchat_id` int(11) unsigned NOT NULL, `dep_id` int(11) unsigned NOT NULL, `tbot_id` int(11) unsigned NOT NULL, `utime` int(11) unsigned NOT NULL, `ctime` int(11) unsigned NOT NULL, `first_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `last_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `username` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `language_code` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `tchat_id` (`tchat_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" + "lhc_telegram_chat" : "CREATE TABLE `lhc_telegram_chat` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `chat_id` bigint(20) unsigned NOT NULL, `tchat_id` bigint(20) unsigned NOT NULL, `bot_id` bigint(20) unsigned NOT NULL, `ctime` bigint(20) unsigned NOT NULL, `utime` bigint(20) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `tchat_id_utime` (`tchat_id`,`utime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", + "lhc_telegram_bot" : "CREATE TABLE `lhc_telegram_bot` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bot_username` varchar(50) NOT NULL, `bot_api` varchar(50) NOT NULL, `bot_disabled` tinyint(1) unsigned NOT NULL, `dep_id` bigint(20) unsigned NOT NULL, `bot_client` bigint(20) unsigned NOT NULL, `webhook_set` bigint(20) unsigned NOT NULL, `chat_timeout` bigint(20) unsigned NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", + "lhc_telegram_signature" : "CREATE TABLE `lhc_telegram_signature` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bot_id` bigint(20) unsigned unsigned NOT NULL, `user_id` bigint(20) unsigned NOT NULL, `signature` text NOT NULL, PRIMARY KEY (`id`), KEY `bot_id_user_id` (`bot_id`,`user_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", + "lhc_telegram_operator" : "CREATE TABLE `lhc_telegram_operator` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bot_id` bigint(20) unsigned unsigned NOT NULL, `chat_id` bigint(20) unsigned NOT NULL,`tchat_id` bigint(20) unsigned NOT NULL, `tuser_id` bigint(20) unsigned NOT NULL, `user_id` bigint(20) unsigned NOT NULL ,`confirmed` tinyint(1) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `bot_id` (`bot_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", + "lhc_telegram_bot_dep" : "CREATE TABLE `lhc_telegram_bot_dep` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `bot_id` bigint(20) unsigned unsigned NOT NULL, `dep_id` bigint(20) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `bot_id` (`bot_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", + "lhc_telegram_lead" : "CREATE TABLE `lhc_telegram_lead` (`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `tchat_id` bigint(20) unsigned unsigned NOT NULL, `dep_id` bigint(20) unsigned NOT NULL, `tbot_id` bigint(20) unsigned NOT NULL, `utime` bigint(20) unsigned NOT NULL, `ctime` bigint(20) unsigned NOT NULL, `first_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `last_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `username` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `language_code` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `tchat_id` (`tchat_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4" } } \ No newline at end of file diff --git a/modules/lhtelegram/callback.php b/modules/lhtelegram/callback.php index 11067b4..39e23b6 100644 --- a/modules/lhtelegram/callback.php +++ b/modules/lhtelegram/callback.php @@ -1,10 +1,8 @@