3 Commits
0.4.0 ... 0.7.0

Author SHA1 Message Date
74d2eaa62b several selections system + integrations 2026-02-27 23:42:35 +05:00
0692db9c80 receivers 2026-02-25 23:40:04 +05:00
ebba2a970e architecture, hours, settings, creating process logics 2026-02-23 23:34:24 +05:00
20 changed files with 970 additions and 419 deletions

View File

@@ -37,7 +37,7 @@
"react/filesystem": "^0.1.2", "react/filesystem": "^0.1.2",
"nyholm/psr7": "^1.8", "nyholm/psr7": "^1.8",
"irazasyed/telegram-bot-sdk": "^3.15", "irazasyed/telegram-bot-sdk": "^3.15",
"nutgram/nutgram": "^4.40", "nutgram/nutgram": "^4.42",
"psr/simple-cache": "^3.0", "psr/simple-cache": "^3.0",
"symfony/cache": "^8.0" "symfony/cache": "^8.0"
}, },

14
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "1f5b64f8a594a24294320f54e2470337", "content-hash": "44219ee87ec9e34c98a5404150eb4ac0",
"packages": [ "packages": [
{ {
"name": "badfarm/zanzara", "name": "badfarm/zanzara",
@@ -1923,16 +1923,16 @@
}, },
{ {
"name": "nutgram/nutgram", "name": "nutgram/nutgram",
"version": "4.40.2", "version": "4.42.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nutgram/nutgram.git", "url": "https://github.com/nutgram/nutgram.git",
"reference": "caf0deb11f6dae93b407f5bb85a94d5336a1b945" "reference": "034257dbc29947b73e04b5d92b07d780d8962810"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nutgram/nutgram/zipball/caf0deb11f6dae93b407f5bb85a94d5336a1b945", "url": "https://api.github.com/repos/nutgram/nutgram/zipball/034257dbc29947b73e04b5d92b07d780d8962810",
"reference": "caf0deb11f6dae93b407f5bb85a94d5336a1b945", "reference": "034257dbc29947b73e04b5d92b07d780d8962810",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1994,7 +1994,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/nutgram/nutgram/issues", "issues": "https://github.com/nutgram/nutgram/issues",
"source": "https://github.com/nutgram/nutgram/tree/4.40.2" "source": "https://github.com/nutgram/nutgram/tree/4.42.0"
}, },
"funding": [ "funding": [
{ {
@@ -2006,7 +2006,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2026-01-25T17:57:40+00:00" "time": "2026-02-12T17:23:52+00:00"
}, },
{ {
"name": "nyholm/psr7", "name": "nyholm/psr7",

View File

@@ -10,7 +10,7 @@ return [
// Главное меню // Главное меню
'menu_title' => 'Главное меню', 'menu_title' => 'Главное меню',
'menu_description_guest' => "🔥 *Создайте ваш первый проект* и получите *ориентировочную стоимость* всего за 2 минуты", 'menu_description_guest' => "🔥 *Создайте ваш первый проект* и получите *ориентировочную стоимость* всего за 2 минуты",
'menu_description_partner' => "*Благодарю за выбор нашей команды*. Теперь Вы один из наших %d партнёров!", 'menu_description_partner' => "*Благодарю за выбор нашей команды*\. Теперь Вы один из наших %d партнёров!",
'menu_update' => 'Последнее обновление', 'menu_update' => 'Последнее обновление',
'menu_button_project_new' => 'Создать', 'menu_button_project_new' => 'Создать',
'menu_button_projects' => 'Проекты', 'menu_button_projects' => 'Проекты',
@@ -24,14 +24,18 @@ return [
// Проект: создание // Проект: создание
'project_create_title' => 'Создание проекта', 'project_create_title' => 'Создание проекта',
'project_create_description' => 'Получите ориентировочную стоимость всего за 2 минуты\!', /* 'project_create_description' => "Расчитайте ориентировочное время разработки, затем выберите разработчиков и получите стоимость\n\nПосле расчётов можно будет отправить проект в заказ разработчикам и приложить ТЗ, либо краткое описание задачи\n\nМы погружаемся в проекты полностью, поэтому стараемся не распыляться - от степени нагрузки меняется коэффициент стоимости!", */
'project_create_cost' => 'Стоимость', 'project_create_description' => "Задайте параметры и получите ориентировочное время разработки, затем выберите разработчиков и получите стоимость их работы\n\nосле расчётов можно отправить проект в заказ и приложить ТЗ, либо описание задачи_",
'project_create_time' => 'Время разработки',
'project_create_time_hours' => 'ч',
'project_create_time_hours_from' => 'от',
'project_create_button_back' => 'Назад',
'project_create_button_request' => 'Заказать', 'project_create_button_request' => 'Заказать',
'project_create_types_title' => 'Выбор типа проекта', 'project_create_architectures_title' => 'Выбор архитектуры проекта',
'project_create_types_description' => 'Каждый тип имеет уникальные параметры и коэффициент', 'project_create_architectures_description' => 'Каждая архитектура имеет уникальные параметры и коэффициенты \- это основа дальнейших расчётов\!',
'project_create_button_type' => 'Тип проекта', 'project_create_button_architecture' => 'Архитектура',
'project_create_button_type_selected' => 'Тип', 'project_create_button_architecture_selected' => 'Архитектура',
'project_create_purposes_title' => 'Выбор назначения', 'project_create_purposes_title' => 'Выбор назначения',
'project_create_purposes_description' => 'Вектор разработки, основание проекта', 'project_create_purposes_description' => 'Вектор разработки, основание проекта',
@@ -39,21 +43,33 @@ return [
'project_create_button_purpose_selected' => 'Назнач.', 'project_create_button_purpose_selected' => 'Назнач.',
'project_create_integrations_title' => 'Выбор интеграций', 'project_create_integrations_title' => 'Выбор интеграций',
'project_create_integrations_description' => 'Синхронизация, скачивание, загрузка, запись...', 'project_create_integrations_description' => "Синхронизация данных в реальном времени, скачивание, загрузка, перенос информации, админ\-панель, рассылка сообщений, подключение аккаунтов\.\.\.\n\n_Отправка запросов в *API*, генерация и перехват *HTTP\-сообщений*, *эмуляция* действий пользователя через *виртуальный браузер* с курсором мыши и клавиатурой, либо *нестандартные протоколы связи*_",
'project_create_button_integrations' => 'Интеграции', 'project_create_button_integrations' => 'Интеграции',
'project_create_button_integrations_selected' => 'Интеграции', 'project_create_button_integrations_selected' => 'Интеграции',
'project_create_requested' => 'Проект создан и отправлен оператору', 'project_create_requested' => 'Проект создан и отправлен оператору',
'project_create_cancelled' => 'Создание проекта отменено', 'project_create_cancelled' => 'Создание проекта отменено',
'project_request_title' => 'Заказ #%d',
'project_request_architecture' => 'Архитектура',
'project_request_purpose' => 'Назначение',
'project_request_hours' => 'Часы',
'project_request_cost' => 'Стоимость',
'project_request_command' => 'Команда',
'project_request_empty' => 'Пусто',
'project_request_button_accept' => 'Принять',
'project_request_button_refuse' => 'Отказать',
'project_request_button_edit' => 'Редактировать',
'project_request_button_chat' => 'Чат с заказчиком',
// Проект: типы // Проект: типы
'project_type_chat_robot' => 'Чат-робот', 'project_architecture_chat_robot' => 'Чат-робот',
'project_type_parser' => 'Парсер', 'project_architecture_parser' => 'Парсер',
'project_type_calculator' => 'Калькулятор', 'project_architecture_calculator' => 'Калькулятор',
'project_type_crm' => 'CRM', 'project_architecture_crm' => 'CRM',
'project_type_site' => 'Сайт', 'project_architecture_site' => 'Сайт',
'project_type_program' => 'Программа', 'project_architecture_program' => 'Программа',
'project_type_complex' => 'Нестандартный', 'project_architecture_complex' => 'Нестандартная',
// Проект: назначение // Проект: назначение
'project_purpose_funnel' => 'Воронка', 'project_purpose_funnel' => 'Воронка',
@@ -65,13 +81,22 @@ return [
'project_purpose_marketplace' => 'Маркетплейс', 'project_purpose_marketplace' => 'Маркетплейс',
'project_purpose_charity' => 'Благотворительность', 'project_purpose_charity' => 'Благотворительность',
'project_purpose_search' => 'Поиск', 'project_purpose_search' => 'Поиск',
'project_purpose_calculate' => 'Расчёт', 'project_purpose_calcul+ate' => 'Расчёт',
'project_purpose_tools' => 'Инструменты', 'project_purpose_tools' => 'Инструменты',
'project_purpose_workers' => 'Рабочие', 'project_purpose_workers' => 'Рабочие',
'project_purpose_objects' => 'Предметы', 'project_purpose_objects' => 'Предметы',
'project_purpose_events' => 'События', 'project_purpose_events' => 'События',
'project_purpose_special' => 'Особенный', 'project_purpose_special' => 'Особенный',
// Проект: интеграции
'project_integration_one_c' => '1C',
'project_integration_bitrix24' => 'Битрикс 24',
'project_integration_moy_sklad' => 'Мой Склад',
'project_integration_telegram' => 'Телеграм',
'project_integration_mail' => 'Почта',
'project_integration_excel' => 'Excel',
/* 'project_integration_' => '', */
// Настройки: язык // Настройки: язык
'settings_language_title' => 'Выбери язык', 'settings_language_title' => 'Выбери язык',
'settings_language_description' => 'Выбранный язык будет использоваться для генерации системного отображения', 'settings_language_description' => 'Выбранный язык будет использоваться для генерации системного отображения',

View File

@@ -5,7 +5,8 @@ declare(strict_types=1);
namespace kodorvan\constructor\models\project\enumerations; namespace kodorvan\constructor\models\project\enumerations;
// Files of the project // Files of the project
use kodorvan\constructor\models\project\enumerations\purpose; use kodorvan\constructor\models\project\enumerations\purpose,
kodorvan\constructor\models\project\enumerations\integration;
// The library for languages support // The library for languages support
use mirzaev\languages\language; use mirzaev\languages\language;
@@ -18,22 +19,22 @@ use InvalidArgumentException as exception_argument,
DomainException as exception_domain; DomainException as exception_domain;
/** /**
* Type * Architecture
* *
* @package kodorvan\neurobot\models\project\enumerations * @package kodorvan\neurobot\models\project\enumerations
* *
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License * @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy> * @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/ */
enum type enum architecture
{ {
case chat_robot; case chat_robot;
case parser; case parser;
case calculator; case script;
case crm; case crm;
/* case marketplace; */
case site; case site;
case program; case program;
/* case calculator; */
case complex; case complex;
@@ -42,7 +43,7 @@ enum type
* *
* @param language $language The language * @param language $language The language
* *
* @return string The project type label * @return string The project architecture label
*/ */
public function label(language $language = LANGUAGE_DEFAULT): string public function label(language $language = LANGUAGE_DEFAULT): string
{ {
@@ -56,17 +57,13 @@ enum type
language::en => 'Parser', language::en => 'Parser',
language::ru => 'Парсер' language::ru => 'Парсер'
}, },
static::calculator => match ($language) { static::script => match ($language) {
language::en => 'Calculator', language::en => 'Script',
language::ru => 'Калькулятор' language::ru => 'Скрипт'
}, },
static::crm => match ($language) { static::crm => match ($language) {
default => 'CRM' default => 'CRM'
}, },
/* static::marketplace => match ($language) {
language::en => 'Marketplace',
language::ru => 'Маркетплейс'
}, */
static::site => match ($language) { static::site => match ($language) {
language::en => 'Site', language::en => 'Site',
language::ru => 'Сайт' language::ru => 'Сайт'
@@ -93,9 +90,8 @@ enum type
return match ($this) { return match ($this) {
static::chat_robot => 2, static::chat_robot => 2,
static::parser => 1, static::parser => 1,
static::calculator => 2, static::script => 1,
static::crm => 1, static::crm => 1,
/* static::marketplace => 4, */
static::site => 1, static::site => 1,
static::program => 1, static::program => 1,
static::complex => 2, static::complex => 2,
@@ -110,6 +106,13 @@ enum type
*/ */
public function purposes(): array public function purposes(): array
{ {
// Initializing purposes
$purposes = purpose::cases();
// Deleting the special purpose
$indexes = array_keys($purposes, purpose::special);
foreach ($indexes as $index) unset($purposes[$index]);
// Exit (success) // Exit (success)
return match ($this) { return match ($this) {
static::chat_robot => [ static::chat_robot => [
@@ -119,6 +122,7 @@ enum type
purpose::game, purpose::game,
purpose::gallery, purpose::gallery,
purpose::crm, purpose::crm,
purpose::calculate,
purpose::landing, purpose::landing,
purpose::marketplace, purpose::marketplace,
purpose::events, purpose::events,
@@ -127,8 +131,8 @@ enum type
static::parser => [ static::parser => [
purpose::search purpose::search
], ],
static::calculator => [ static::script => [
purpose::calculate purpose::logic
], ],
static::crm => [ static::crm => [
purpose::workers, purpose::workers,
@@ -142,6 +146,7 @@ enum type
purpose::neural_network, purpose::neural_network,
purpose::gallery, purpose::gallery,
purpose::crm, purpose::crm,
purpose::calculate,
purpose::landing, purpose::landing,
purpose::marketplace, purpose::marketplace,
purpose::workers, purpose::workers,
@@ -153,6 +158,7 @@ enum type
static::program => [ static::program => [
purpose::neural_network, purpose::neural_network,
purpose::crm, purpose::crm,
purpose::calculate,
purpose::marketplace, purpose::marketplace,
purpose::workers, purpose::workers,
purpose::tools, purpose::tools,
@@ -164,10 +170,50 @@ enum type
}; };
} }
/**
* Integrations
*
* @return array Integrations
*/
/* public function integrations(): array
{
// Exit (success)
return match ($this) {
static::chat_robot => [
integration::one_c,
integration::moy_sklad
],
static::parser => [
integration::one_c,
integration::moy_sklad
],
static::script => [],
static::crm => [
integration::one_c,
integration::moy_sklad
],
static::site => [
integration::one_c,
integration::moy_sklad
],
static::program => [
integration::one_c,
integration::moy_sklad
],
static::complex => [
integration::one_c,
integration::moy_sklad
],
default => []
};
} */
/** /**
* Cost * Cost
* *
* @return int|float The minimal cost of the project development * @return int|float The minimal cost of the project development
*
* @deprecated
*/ */
public function cost(currency $currency = CURRENCY_DEFAULT): int|float public function cost(currency $currency = CURRENCY_DEFAULT): int|float
{ {
@@ -181,9 +227,9 @@ enum type
currency::usd => 35, currency::usd => 35,
currency::rub => 3500 currency::rub => 3500
}, },
static::calculator => match ($currency) { static::script => match ($currency) {
currency::usd => 40, currency::usd => 10,
currency::rub => 4000 currency::rub => 1000
}, },
static::crm => match ($currency) { static::crm => match ($currency) {
currency::usd => 100, currency::usd => 100,
@@ -203,4 +249,24 @@ enum type
} }
}; };
} }
/**
* Coefficient
*
* @return int The project development hours
*/
public function coefficient(): int|float
{
// Exit (success)
return (int) match ($this) {
static::chat_robot => 3,
static::parser => 2,
static::script => 1,
static::crm => 6,
static::site => 3,
static::program => 4,
static::complex => 5,
default => 5
};
}
} }

View File

@@ -0,0 +1,99 @@
<?php
declare(strict_types=1);
namespace kodorvan\constructor\models\project\enumerations;
// The library for languages support
use mirzaev\languages\language;
// Built-in libraries
use InvalidArgumentException as exception_argument,
DomainException as exception_domain;
/**
* Integration
*
* @package kodorvan\neurobot\models\project\enumerations
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/
enum integration
{
case one_c;
case bitrix24;
case moy_sklad;
case telegram;
case mail;
case excel;
/**
* Label
*
* @param language $language The language
*
* @return string The project form label
*/
public function label(language $language = LANGUAGE_DEFAULT): string
{
// Exit (success)
return match ($this) {
static::one_c => '1C',
static::bitrix24 => match ($language) {
language::en => 'Bitrix 24',
language::ru => 'Битрикс 24'
},
static::moy_sklad => match ($language) {
language::en => 'Moy Sklad',
language::ru => 'Мой Склад'
},
static::telegram => match ($language) {
language::en => 'Telegram',
language::ru => 'Телеграм'
},
static::mail => match ($language) {
language::en => 'Mail',
language::ru => 'Почта'
},
static::excel => 'Excel'
};
}
/**
* Length
*
* @return int Amount of buttons cells length
*/
public function length(): int
{
// Exit (success)
return match ($this) {
static::one_c => 1,
static::bitrix24 => 2,
static::moy_sklad => 2,
static::telegram => 2,
static::mail => 1,
static::excel => 1,
};
}
/**
* Coefficient
*
* @return int|float Coefficient to the project development hours
*/
public function coefficient(): int|float
{
// Exit (success)
return match ($this) {
static::one_c => 5,
static::bitrix24 => 3.5,
static::moy_sklad => 3,
static::telegram => 2,
static::mail => 1.2,
static::excel => 1.5,
default => 2
};
}
}

View File

@@ -31,6 +31,7 @@ enum purpose
case charity; case charity;
case search; case search;
case calculate; case calculate;
case logic;
case game; case game;
case workers; case workers;
@@ -45,7 +46,7 @@ enum purpose
* *
* @param language $language The language * @param language $language The language
* *
* @return string The project type label * @return string The project form label
*/ */
public function label(language $language = LANGUAGE_DEFAULT): string public function label(language $language = LANGUAGE_DEFAULT): string
{ {
@@ -61,7 +62,7 @@ enum purpose
}, },
static::neural_network => match ($language) { static::neural_network => match ($language) {
language::en => 'Neural network', language::en => 'Neural network',
language::ru => 'Нейросети' language::ru => 'Нейросеть'
}, },
static::game => match ($language) { static::game => match ($language) {
language::en => 'Game', language::en => 'Game',
@@ -94,6 +95,10 @@ enum purpose
language::en => 'Calculate', language::en => 'Calculate',
language::ru => 'Расчёты' language::ru => 'Расчёты'
}, },
static::logic => match ($language) {
language::en => 'Logic',
language::ru => 'Логика'
},
static::game => match ($language) { static::game => match ($language) {
language::en => 'Game', language::en => 'Game',
language::ru => 'Игра' language::ru => 'Игра'
@@ -121,6 +126,85 @@ enum purpose
}; };
} }
/**
* Integrations
*
* @return array Integrations
*/
public function integrations(): array
{
// Exit (success)
return match ($this) {
static::funnel => [
integration::telegram,
integration::mail,
integration::bitrix24
],
static::contact => [
integration::mail,
integration::bitrix24
],
static::neural_network => [
integration::telegram
],
static::game => [
integration::telegram
],
static::gallery => [],
static::crm => [
integration::one_c,
integration::moy_sklad,
integration::excel
],
static::landing => [
integration::telegram
],
static::marketplace => [
integration::one_c,
integration::moy_sklad,
integration::excel
],
static::charity => [
integration::one_c,
integration::moy_sklad,
integration::excel
],
static::search => [],
static::calculate => [
integration::one_c,
integration::moy_sklad,
integration::excel
],
static::logic => [],
static::tools => [
integration::one_c,
integration::moy_sklad,
integration::excel
],
static::workers => [
integration::one_c,
integration::moy_sklad,
integration::excel
],
static::objects => [
integration::one_c,
integration::moy_sklad,
integration::excel
],
static::events => [
integration::one_c,
integration::moy_sklad,
integration::excel
],
static::special => [
integration::one_c,
integration::moy_sklad,
integration::excel
],
default => []
};
}
/** /**
* Length * Length
* *
@@ -141,6 +225,7 @@ enum purpose
static::charity => 2, static::charity => 2,
static::search => 2, static::search => 2,
static::calculate => 2, static::calculate => 2,
static::logic => 1,
static::tools => 1, static::tools => 1,
static::workers => 1, static::workers => 1,
static::objects => 1, static::objects => 1,
@@ -153,7 +238,7 @@ enum purpose
/** /**
* Coefficient * Coefficient
* *
* @return int|float Coefficient to the project development cost * @return int|float Coefficient to the project development hours
*/ */
public function coefficient(): int|float public function coefficient(): int|float
{ {
@@ -170,6 +255,7 @@ enum purpose
static::charity => 0.8, static::charity => 0.8,
static::search => 1, static::search => 1,
static::calculate => 1.1, static::calculate => 1.1,
static::logic => 1,
static::tools => 1, static::tools => 1,
static::workers => 1.2, static::workers => 1.2,
static::objects => 1, static::objects => 1,

View File

@@ -5,8 +5,7 @@ declare(strict_types=1);
namespace kodorvan\constructor\models\telegram\middlewares; namespace kodorvan\constructor\models\telegram\middlewares;
// Files of the project // Files of the project
use kodorvan\constructor\models\core, use kodorvan\constructor\models\account as model,
kodorvan\constructor\models\account as model,
kodorvan\constructor\models\authorizations; kodorvan\constructor\models\authorizations;
// The library for languages support // The library for languages support
@@ -30,7 +29,7 @@ use Error as error;
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License * @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy> * @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/ */
final class account extends core final class account
{ {
/** /**
* Account * Account

View File

@@ -5,8 +5,7 @@ declare(strict_types=1);
namespace kodorvan\constructor\models\telegram\middlewares; namespace kodorvan\constructor\models\telegram\middlewares;
// Files of the project // Files of the project
use kodorvan\constructor\models\core, use kodorvan\constructor\models\account,
kodorvan\constructor\models\account,
kodorvan\constructor\models\authorizations as model; kodorvan\constructor\models\authorizations as model;
// The library for languages support // The library for languages support
@@ -30,7 +29,7 @@ use Error as error;
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License * @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy> * @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/ */
final class authorizations extends core final class authorizations
{ {
/** /**
* Authorizations * Authorizations

View File

@@ -5,8 +5,7 @@ declare(strict_types=1);
namespace kodorvan\constructor\models\telegram\middlewares; namespace kodorvan\constructor\models\telegram\middlewares;
// Files of the project // Files of the project
use kodorvan\constructor\models\core, use kodorvan\constructor\models\account,
kodorvan\constructor\models\account,
kodorvan\constructor\models\authorizations; kodorvan\constructor\models\authorizations;
// The library for languages support // The library for languages support
@@ -30,7 +29,7 @@ use Error as error;
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License * @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy> * @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/ */
final class language extends core final class language
{ {
/** /**
* Language * Language

View File

@@ -5,8 +5,7 @@ declare(strict_types=1);
namespace kodorvan\constructor\models\telegram\middlewares; namespace kodorvan\constructor\models\telegram\middlewares;
// Files of the project // Files of the project
use kodorvan\constructor\models\core, use kodorvan\constructor\models\account,
kodorvan\constructor\models\account,
kodorvan\constructor\models\localization as model, kodorvan\constructor\models\localization as model,
kodorvan\constructor\models\authorizations; kodorvan\constructor\models\authorizations;
@@ -32,7 +31,7 @@ use Exception as exception,
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License * @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy> * @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/ */
final class localization extends core final class localization
{ {
/** /**
* Localization * Localization

View File

@@ -5,8 +5,7 @@ declare(strict_types=1);
namespace kodorvan\constructor\models\telegram\middlewares; namespace kodorvan\constructor\models\telegram\middlewares;
// Files of the project // Files of the project
use kodorvan\constructor\models\core, use kodorvan\constructor\models\account,
kodorvan\constructor\models\account,
kodorvan\constructor\models\authorizations; kodorvan\constructor\models\authorizations;
// The library for languages support // The library for languages support
@@ -30,7 +29,7 @@ use Error as error;
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License * @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy> * @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/ */
final class settings extends core final class settings
{ {
/** /**
* Settings * Settings
@@ -75,7 +74,7 @@ final class settings extends core
// Sending the message // Sending the message
$robot->sendMessage( $robot->sendMessage(
text: '⛔ *' . $localization['not_authorized_settings'] . '*', text: "⛔ *$localization->not_authorized_settings*",
parse_mode: mode::MARKDOWN parse_mode: mode::MARKDOWN
); );

View File

@@ -5,8 +5,7 @@ declare(strict_types=1);
namespace kodorvan\constructor\models\telegram\middlewares\system; namespace kodorvan\constructor\models\telegram\middlewares\system;
// Files of the project // Files of the project
use kodorvan\constructor\models\core, use kodorvan\constructor\models\account,
kodorvan\constructor\models\account,
kodorvan\constructor\models\authorizations; kodorvan\constructor\models\authorizations;
// The library for languages support // The library for languages support
@@ -23,14 +22,14 @@ use SergiX44\Nutgram\Nutgram as telegram,
use Error as error; use Error as error;
/** /**
* Telegram middleware: language * Telegram middleware: system settings
* *
* @package kodorvan\constructor\models\telegram\middlewares\system * @package kodorvan\constructor\models\telegram\middlewares\system
* *
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License * @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy> * @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/ */
final class settings extends core final class settings
{ {
/** /**
* System settings (middleware) * System settings (middleware)

View File

@@ -1,109 +0,0 @@
<?php
declare(strict_types=1);
namespace kodorvan\constructor;
// Files of the project
use kodorvan\constructor\models\account,
kodorvan\constructor\models\telegram\middlewares,
kodorvan\constructor\models\telegram\commands\start,
kodorvan\constructor\models\telegram\settings;
// Library for languages support
use mirzaev\languages\language;
// Framework for PHP
use mirzaev\minimal\core,
mirzaev\minimal\route;
// Framework for Telegram
use Telegram\Bot\BotsManager as telegram;
// Enabling debugging
/* ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); */
// Initializing path to the public directory
define('INDEX', __DIR__);
// Initializing path to the project root directory
define('ROOT', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
// Initializing path to the directory of views
define('VIEWS', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'views');
// Initializing path to the directory of settings
define('SETTINGS', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'settings');
// Initializing system settings
require SETTINGS . DIRECTORY_SEPARATOR . 'system.php';
// Initializing path to the directory of the storage
define('STORAGE', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'storage');
// Initializing path to the databases directory
define('DATABASES', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'databases');
// Initializing path to the localizations directory
define('LOCALIZATIONS', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'localizations');
// Initiailizing Telegram chat-robot settings
define('TELEGRAM', require(SETTINGS . DIRECTORY_SEPARATOR . 'telegram.php'));
// Initializing dependencies
require ROOT . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
// Initializing the robots manager settings
$settings = [
'bots' => [
'constructor' => [
'token' => TELEGRAM['constructor']['key'],
'certificate_path' => PROJECT_CERTIFICATE,
'webhook_url' => 'https://' . PROJECT_DOMAIN . '/telegram/constructor.php',
'commands' => [
start::class,
]
],
'async_requests' => true,
'base_bot_url' => 'https://' . PROJECT_DOMAIN . '/telegram',
]
];
// Initializing the robots manager
$robot = new telegram($settings);
var_dump($telegram->bot('constructor')->getWebhookUpdate());
/* // Initializing the updates listener
$robot->onUpdate(function (context $context): void {});
// Initializing the robot middlewares
$robot->middleware([middlewares::class, 'account']);
$robot->middleware([middlewares::class, 'language']);
$robot->middleware([middlewares::class, 'localization']);
$robot->middleware([middlewares::class, 'authorizations']);
// Initializing the robot commands handlers
$robot->onCommand('start', [commands::class, 'start']);
$robot->onCommand('start telegram voronka', [commands::class, 'start']);
$robot->onCommand('start parser', [commands::class, 'start']);
$robot->onCommand('start calculator', [commands::class, 'start']);
$robot->onCommand('language', [commands::class, 'language'])->middleware([middlewares::class, 'settings']);
$robot->onCommand('society', [commands::class, 'society']);
// Initializing the robot settings language buttons handlers
foreach (language::cases() as $language) {
// Iterating over languages
// Initializing language buttons
$robot->onCbQueryData(["settings_language_$language->name"], fn(context $context) => settings::language($context, $language));
};
$robot->onCbQueryData('project_create', ['process_project_create', 'name']);
// Starting chat-robot
$robot->run(); */

View File

@@ -60,9 +60,9 @@ require ROOT . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
// Initializing the robot // Initializing the robot
$robot = new telegram( $robot = new telegram(
token: TELEGRAM['constructor']['key'], token: TELEGRAM['key'],
config: new telegram_settings( config: new telegram_settings(
botName: TELEGRAM['constructor']['name'] botName: TELEGRAM['name']
) )
); );
@@ -72,5 +72,5 @@ $robot->setWebhook(
ip_address: SERVER_IP_ADDRESS, ip_address: SERVER_IP_ADDRESS,
max_connections: 10, max_connections: 10,
drop_pending_updates: false, drop_pending_updates: false,
secret_token: 'bebra228' secret_token: TELEGRAM['password']
); );

View File

@@ -71,14 +71,14 @@ require ROOT . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
// Initializing the robot // Initializing the robot
$robot = new telegram( $robot = new telegram(
token: TELEGRAM['constructor']['key'], token: TELEGRAM['key'],
config: new telegram_settings( config: new telegram_settings(
botName: TELEGRAM['constructor']['name'], botName: TELEGRAM['name'],
cache: new cache(new cache_adapter()) cache: new cache(new cache_adapter())
) )
); );
$webhook = new webhook(secretToken: 'bebra228'); $webhook = new webhook(secretToken: TELEGRAM['password']);
$webhook->setSafeMode(true); $webhook->setSafeMode(true);
$robot->setRunningMode($webhook); $robot->setRunningMode($webhook);
@@ -88,7 +88,6 @@ $robot->middleware(middleware_language::class);
$robot->middleware(middleware_localization::class); $robot->middleware(middleware_localization::class);
$robot->middleware(middleware_authorizations::class); $robot->middleware(middleware_authorizations::class);
// Start // Start
$robot->registerCommand(command_start::class); $robot->registerCommand(command_start::class);
$robot->onCommand('start telegram voronka', command_start::class); $robot->onCommand('start telegram voronka', command_start::class);

View File

@@ -1,3 +1,5 @@
* *
!.gitignore !.gitignore
!*.sample !*.sample
!*/
!*.md

View File

@@ -0,0 +1 @@
openssl req -newkey rsa:2048 -sha256 -nodes -keyout private.key -x509 -days 365 -out public.pem -subj "/C=US/ST=New York/L=Brooklyn/O=Example Brooklyn Company/CN=Sex"

View File

@@ -21,9 +21,18 @@ define('PROJECT_MEDIA_URL', 'https://t.me/kodorvan');
define('PROJECT_OPERATOR_URL', 'https://t.me/kodorvan?direct'); define('PROJECT_OPERATOR_URL', 'https://t.me/kodorvan?direct');
define('PROJECT_REPOSITORY', REPOSITORY . '/' . PROJECT_CREATOR . '/' . PROJECT_NAME); define('PROJECT_REPOSITORY', REPOSITORY . '/' . PROJECT_CREATOR . '/' . PROJECT_NAME);
define('PROJECT_REPOSITORY_LANGUAGE_ADD', PROJECT_REPOSITORY . '/src/branch/stable/' . PROJECT_CREATOR . '/' . PROJECT_NAME . '/system/localizations'); define('PROJECT_REPOSITORY_LANGUAGE_ADD', PROJECT_REPOSITORY . '/src/branch/stable/' . PROJECT_CREATOR . '/' . PROJECT_NAME . '/system/localizations');
/* define('PROJECT_CERTIFICATE', SETTINGS . DIRECTORY_SEPARATOR . 'cert.pem'); */
define('CURRENCY_DEFAULT', currency::usd); define('PROJECT_CREATE_START_HOURS', 1);
define('PROJECT_CREATE_START_COEFFICIENT', 0);
define('PROJECT_CREATE_HOURS_ADDITIONAL', 0);
define('PROJECT_CREATE_HOURS_MINIMAL', 4);
define('PROJECT_CREATE_COST_HOUR_DEFAULT', 1200);
define('PROJECT_CREATE_REQUEST_RECEIVERS', [
]);
define('CURRENCY_DEFAULT', currency::rub);
define('LANGUAGE_DEFAULT', language::en); define('LANGUAGE_DEFAULT', language::en);
// Initializing default theme for the views templater // Initializing default theme for the views templater

View File

@@ -2,18 +2,17 @@
// Telegram API chat-robot // Telegram API chat-robot
return [ return [
'constructor' => [ 'identifier' => 0,
'identifier' => 0, 'domain' => 'kodorvan_bot',
'name' => 'kodorvan', 'name' => 'kodorvan',
'domain' => '', 'password' => '',
'key' => '', 'key' => '',
'database' => [ 'database' => [
'host' => '/run/mysqld/mysqld.sock', 'host' => '/run/mysqld/mysqld.sock',
'port' => 3306, 'port' => 3306,
'user' => '', 'user' => '',
'password' => '', 'password' => '',
'database' => '', 'database' => '',
]
] ]
]; ];