Change some names around

This commit is contained in:
Little Fluffy Clouds 2025-07-09 18:55:20 +03:00
parent d867d640a4
commit 319076b682
163 changed files with 1618 additions and 1620 deletions

View File

@ -1,56 +1,56 @@
{
"name": "mirzaev/deeproots",
"description": "",
"homepage": "https://git.svoboda.works/mirzaev/deeproots",
"type": "site",
"keywords": [
"minimal",
"baza"
],
"readme": "README.md",
"license": "WTFPL",
"authors": [
{
"name": "mirzaev",
"email": "mirzaev@gmail.com",
"homepage": "https://mirzaev.page",
"role": "Programmer"
}
],
"support": {
"wiki": "https://git.svoboda.works/mirzaev/deeproots/wiki",
"issues": "https://git.svoboda.works/mirzaev/deeproots/issues"
},
"require": {
"php": "^8.4",
"mirzaev/minimal": "^3.4",
"mirzaev/baza": "^3.3",
"twig/twig": "^3.10",
"twig/extra-bundle": "^3.7",
"twig/intl-extra": "^3.10",
"svoboda/time": "^1.0",
"badfarm/zanzara": "^0.9.1",
"nyholm/psr7": "^1.8",
"react/filesystem": "^0.1.2",
"react/async": "^4.3"
},
"autoload": {
"psr-4": {
"mirzaev\\deeproots\\": "mirzaev/deeproots/system"
}
},
"autoload-dev": {
"psr-4": {
"mirzaev\\deeproots\\tests\\": "mirzaev/deeproots/tests"
}
},
"scripts": {
"pre-update-cmd": "./install.sh"
},
"config": {
"allow-plugins": {
"php-http/discovery": true,
"wyrihaximus/composer-update-bin-autoload-path": true
}
}
"name": "deeproots/deeproots",
"description": "",
"homepage": "https://t.me/deeproots_bot",
"type": "site",
"keywords": [
"minimal",
"baza"
],
"readme": "README.md",
"license": "WTFPL",
"authors": [
{
"name": "deeproots",
"email": "deeproots@goatse.cx",
"homepage": "https://t.me/deeproots_bot",
"role": "Triumvirate"
}
],
"support": {
"wiki": "https://git.svoboda.works/lfclouds/deeproots/wiki",
"issues": "https://git.svoboda.works/lfclouds/deeproots/issues"
},
"require": {
"php": "^8.4",
"mirzaev/minimal": "^3.4",
"mirzaev/baza": "^3.3",
"twig/twig": "^3.10",
"twig/extra-bundle": "^3.7",
"twig/intl-extra": "^3.10",
"svoboda/time": "^1.0",
"badfarm/zanzara": "^0.9.1",
"nyholm/psr7": "^1.8",
"react/filesystem": "^0.1.2",
"react/async": "^4.3"
},
"autoload": {
"psr-4": {
"deeproots\\deeproots\\": "mirzaev/deeproots/system"
}
},
"autoload-dev": {
"psr-4": {
"deeproots\\deeproots\\tests\\": "mirzaev/deeproots/tests"
}
},
"scripts": {
"pre-update-cmd": "./install.sh"
},
"config": {
"allow-plugins": {
"php-http/discovery": true,
"wyrihaximus/composer-update-bin-autoload-path": true
}
}
}

View File

@ -0,0 +1,75 @@
<?php
declare(strict_types=1);
namespace deeproots\deeproots\controllers;
// Files of the project
use deeproots\deeproots\models\core as models;
// Framework for PHP
use mirzaev\minimal\core as minimal,
mirzaev\minimal\controller,
mirzaev\minimal\http\response,
mirzaev\minimal\http\enumerations\status;
/**
* Controllers core
*
* @package deeproots\deeproots\controllers
*
* @param language $language Language
* @param response $response Response
* @param array $errors Registry of errors
*
* @method void __construct(minimal $minimal, bool $initialize) Constructor
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author svoboda <mail@domain.zone>
*/
class core extends controller
{
/**
* Language
*
* @var language $language Language
*/
protected language $language = language::en;
/**
* Response
*
* @see https://wiki.php.net/rfc/property-hooks (find a table about backed and virtual hooks)
*
* @var response $response Response
*/
protected response $response {
// Read
get => $this->response ??= $this->request->response();
}
/**
* Errors
*
* @var array $errors Registry of errors
*/
protected array $errors = [
];
/**
* Constructor
*
* @param minimal $core Instance of the MINIMAL
* @param bool $initialize Initialize a controller?
*
* @return void
*/
public function __construct(minimal $core, bool $initialize = true)
{
// Blocking requests from CloudFlare (better to write this blocking into nginx config file)
if (isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] === 'nginx-ssl early hints') return status::bruh->label;
// For the extends system
parent::__construct(core: $core);
}
}

View File

@ -2,10 +2,10 @@
declare(strict_types=1);
namespace mirzaev\deeproots\controllers;
namespace deeproots\deeproots\controllers;
// Files of the project
use mirzaev\deeproots\controllers\core;
use deeproots\deeproots\controllers\core;
// Framework for PHP
use mirzaev\minimal\http\enumerations\content,
@ -14,7 +14,7 @@ use mirzaev\minimal\http\enumerations\content,
/**
* Index
*
* @package mirzaev\deeproots\controllers
* @package deeproots\deeproots\controllers
*
* @param array $errors Registry of errors
*

View File

@ -0,0 +1,184 @@
<?php
// Exit (success)
return [
// System
'deeproots' => 'DeepRoots',
'empty' => 'Empty',
'yes' => 'Yes',
'no' => 'No',
// Main menu
'menu_title' => 'Main menu',
'menu_button_start' => 'Start',
'menu_button_rating' => 'Rating',
'menu_button_balance' => 'Balance',
'menu_button_system_accounts' => 'Accounts',
'menu_button_system_questions' => 'Questions',
'menu_button_system_settings' => 'Settings',
'menu_system_authorized' => 'System authorization found',
// Account
'account_title' => 'Account',
'account_identifier' => 'Identifier',
'account_authorized_system' => 'Access to the system',
'account_authorized_game_play' => 'Access to play games',
'account_authorized_rating_display' => 'Access to display in the rating',
'account_authorized_balance_deposit' => 'Access to deposit into the balance',
'account_authorized_balance_withdraw' => 'Access to withdraw from the balance',
'account_authorized_settings' => 'Access to settings',
'account_authorized_system_accounts' => 'System access to accounts',
'account_authorized_system_questions' => 'System access to questions',
'account_authorized_system_settings' => 'System access to system settings',
// Language setting
'settings_select_language_title' => 'Select language',
'settings_select_language_description' => 'The selected language will be writed in your account settings',
'settings_language_update_success' => 'Language replaced:',
'settings_language_update_fail' => 'Failed to replace language',
// Language selection
'select_language_title' => 'Select language',
'select_language_description' => 'The selected language will be used in the current process',
'select_language_button_add' => 'Add a language',
// Repository
'repository_title' => 'Repository',
'repository_text' => <<<TXT
Svoboder is written in [PHP](https://www.php.net/) using [Zanzara](https://github.com/badfarm/zanzara) for Telegram,
my [MINIMAL](https://git.svoboda.works/mirzaev/minimal) framework for PHP and my [Baza](https://git.svoboda.works/mirzaev/baza) database
The code is under the [WTFPL](https://en.wikipedia.org/wiki/WTFPL) license
You can help me with the development, or use my code for free\!
TXT,
'repository_button_code' => 'The code',
'repository_button_issues' => 'Issues',
'repository_button_suggestions' => 'Suggestions',
// Author
'author_title' => 'Author',
'author_text' => <<<TXT
*Arsen Mirzaev Tatyano\-Muradovich*
Programmer, anarchist, vegetarian
TXT,
'author_button_neurojournal' => 'Neurojournal',
'author_button_projects' => 'Projects',
'author_button_twitter' => 'Twitter',
'author_button_bluesky' => 'Bluesky',
'author_button_bastyon' => 'Bastyon',
'author_button_youtube_english' => 'YouTube',
'author_button_youtube_russian' => 'YouTube',
'author_button_message' => 'Send a message',
// Questions (system)
'system_questions_title' => 'The questions registry',
'system_questions_questions' => 'Questions',
'system_questions_answers' => 'Answers',
'system_questions_answers_amount_matches' => 'The amount of questions matches the amount of answers',
'system_questions_answers_amount_different' => 'The amount of questions does not match the amount of answers',
'system_questions_amount_matches' => 'The amount of questions matches the amount of localizations',
'system_questions_amount_different' => 'The amount of questions does not match the amount of localizations',
'system_questions_localizations_amount_matches' => 'Amounts of localizations matches with each other',
'system_questions_localizations_amount_different' => 'Amounts of localizations does not match with each other',
'system_questions_button_search' => 'Search',
'system_questions_button_create' => 'Create',
// Question create (system)
'system_questions_create_created' => 'The question was created',
// Question search (system)
'system_questions_search_title' => 'The question search process',
'system_questions_search_continued' => 'The process of the question search found and continued',
'system_questions_search_started' => 'The process of the question search started',
'system_questions_search_not_started' => 'The process of the question search is not started',
'system_questions_search_ended' => 'The process of the question search ended',
'system_questions_search_page_next_exists' => 'There are more questions in the registry',
'system_questions_search_page_next_not_exists' => 'There are no more questions in the registry',
'system_questions_search_empty' => 'No questions found',
'system_questions_search_question_title' => 'Question',
'system_questions_search_question_answer' => 'Answer',
'system_questions_search_identifier_request_title' => 'Enter identifier',
'system_questions_search_identifier_request_not_acceptable' => 'Failed to process the identifier',
'system_questions_search_identifier_request_too_short' => 'Identifier length must be \>\= 1 and \<\= 12',
'system_questions_search_identifier_request_too_long' => 'Identifier length must be \>\= 1 and \<\= 12',
'system_questions_search_identifier_request_restricted_characters_title' => "Restricted any characters except digits",
'system_questions_search_identifier_request_restricted_characters_description' => "Remove these characters:",
'system_questions_search_identifier_cancel_success' => 'Cancelled the identifier replacing process',
'system_questions_search_identifier_delete_success' => 'Identifier deleted',
'system_questions_search_identifier_update_success' => 'Identifier replaced:',
'system_questions_search_identifier_update_fail' => 'Failed to replace identifier',
'system_questions_search_text_request_title' => 'Enter text',
'system_questions_search_text_request_not_acceptable' => 'Failed to process the text',
'system_questions_search_text_request_too_short' => 'Text length must be \>\= 3 and \<\= 256',
'system_questions_search_text_request_too_long' => 'Text length must be \>\= 3 and \<\= 256',
'system_questions_search_text_cancel_success' => 'Cancelled the text replacing process',
'system_questions_search_text_delete_success' => 'Text deleted',
'system_questions_search_text_update_success' => 'Text replaced:',
'system_questions_search_text_update_fail' => 'Failed to replace text',
'system_questions_search_a_request_title' => 'Enter A\-answer',
'system_questions_search_a_request_not_acceptable' => 'Failed to process the A\-answer',
'system_questions_search_a_request_too_short' => 'A\-answer length must be \>\= 3 and \<\= 128',
'system_questions_search_a_request_too_long' => 'A\-answer length must be \>\= 3 and \<\= 128',
'system_questions_search_a_cancel_success' => 'Cancelled the A\-answer replacing process',
'system_questions_search_a_delete_success' => 'A\-answer deleted',
'system_questions_search_a_update_success' => 'A\-answer replaced:',
'system_questions_search_a_update_fail' => 'Failed to replace A\-answer',
'system_questions_search_b_request_title' => 'Enter B\-answer',
'system_questions_search_b_request_not_acceptable' => 'Failed to process the B\-answer',
'system_questions_search_b_request_too_short' => 'B\-answer length must be \>\= 3 and \<\= 128',
'system_questions_search_b_request_too_long' => 'B\-answer length must be \>\= 3 and \<\= 128',
'system_questions_search_b_cancel_success' => 'Cancelled the B\-answer replacing process',
'system_questions_search_b_delete_success' => 'B\-answer deleted',
'system_questions_search_b_update_success' => 'B\-answer replaced:',
'system_questions_search_b_update_fail' => 'Failed to replace B\-answer',
'system_questions_search_c_request_title' => 'Enter C\-answer',
'system_questions_search_c_request_not_acceptable' => 'Failed to process the C\-answer',
'system_questions_search_c_request_too_short' => 'C\-answer length must be \>\= 3 and \<\= 128',
'system_questions_search_c_request_too_long' => 'C\-answer length must be \>\= 3 and \<\= 128',
'system_questions_search_c_cancel_success' => 'Cancelled the C\-answer replacing process',
'system_questions_search_c_delete_success' => 'C\-answer deleted',
'system_questions_search_c_update_success' => 'C\-answer replaced:',
'system_questions_search_c_update_fail' => 'Failed to replace C\-answer',
'system_questions_search_d_request_title' => 'Enter D\-answer',
'system_questions_search_d_request_not_acceptable' => 'Failed to process the D\-answer',
'system_questions_search_d_request_too_short' => 'D\-answer length must be \>\= 3 and \<\= 128',
'system_questions_search_d_request_too_long' => 'D\-answer length must be \>\= 3 and \<\= 128',
'system_questions_search_d_cancel_success' => 'Cancelled the D\-answer replacing process',
'system_questions_search_d_delete_success' => 'D\-answer deleted',
'system_questions_search_d_update_success' => 'D\-answer replaced:',
'system_questions_search_d_update_fail' => 'Failed to replace D\-answer',
'system_questions_search_button_delete' => 'Delete',
'system_questions_search_button_author' => 'Author',
'system_questions_search_button_active' => 'Active',
'system_questions_search_button_inactive' => 'Inactive',
'system_questions_search_button_answer' => 'Answer',
'system_questions_search_button_localizations' => 'Localizations',
'system_questions_search_button_identifier' => 'Identifier',
'system_questions_search_button_text' => 'Text',
'system_questions_search_button_a' => 'A',
'system_questions_search_button_b' => 'B',
'system_questions_search_button_c' => 'C',
'system_questions_search_button_d' => 'D',
'system_questions_search_button_delete' => 'Delete',
'system_questions_search_button_cancel' => 'Cancel',
'system_questions_search_button_page_next' => 'Next page',
'system_questions_search_button_end' => 'End the search process',
'system_questions_search_not_localized' => 'Failed to initialize the question localization',
// Question localization create (system)
'system_questions_localization_create_created' => 'The question localization was created',
// Authorization
'not_authorized_system' => 'You do not have access to the system',
'not_authorized_game_play' => 'You do not have access to play games',
'not_authorized_rating_display' => 'You do not have access to display in the rating',
'not_authorized_balance_deposit' => 'You do not have access to deposit into the balance',
'not_authorized_balance_withdraw' => 'You do not have access to withdraw from the balance',
'not_authorized_settings' => 'You do not have access to the settings',
'not_authorized_system_accounts' => 'You do not have system access to the accounts',
'not_authorized_system_questions' => 'You do not have system access to the questions',
'not_authorized_system_settings' => 'You do not have system access to the system settings',
// Other
'why_so_shroomious' => 'why so shroomious',
];

View File

@ -2,14 +2,14 @@
declare(strict_types=1);
namespace mirzaev\deeproots\models;
namespace deeproots\deeproots\models;
// Files of the project
use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\connection,
mirzaev\deeproots\models\telegram,
mirzaev\deeproots\models\enumerations\language,
mirzaev\deeproots\models\account\localization;
use deeproots\deeproots\models\core,
deeproots\deeproots\models\connection,
deeproots\deeproots\models\telegram,
deeproots\deeproots\models\enumerations\language,
deeproots\deeproots\models\account\localization;
// Svoboda time
use svoboda\time\statement as svoboda;
@ -28,7 +28,7 @@ use Exception as exception,
/**
* Account
*
* @package mirzaev\deeproots\models
* @package deeproots\deeproots\models
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
@ -81,7 +81,7 @@ final class account extends core
/**
* Initialize
*
* Searches for the account record by the telegram account in the database,
* Searches for the account record by the telegram account in the database,
* and if it does not find it, then create the account record and the connection record
*
* @param record $telegram The telegram account
@ -117,7 +117,7 @@ final class account extends core
// Deactivating the connection between missing account and the telegram account
$deactivated = $connected->read(
filter: fn(record $record) => $record->identifier === $connected->identifier,
filter: fn(record $record) => $record->identifier === $connected->identifier,
update: function (record &$record) {
$record->active = 0;
$record->updated = svoboda::timestamp();
@ -126,7 +126,7 @@ final class account extends core
if ($deactivated instanceof record && $deactivated->active === 0) {
// Deactivated the connection between missing account and the telegram account
// Creating the account
goto create;
} else {

View File

@ -2,12 +2,12 @@
declare(strict_types=1);
namespace mirzaev\deeproots\models;
namespace deeproots\deeproots\models;
// Files of the project
use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\question,
mirzaev\deeproots\models\enumerations\language;
use deeproots\deeproots\models\core,
deeproots\deeproots\models\question,
deeproots\deeproots\models\enumerations\language;
// Svoboda time
use svoboda\time\statement as svoboda;
@ -27,7 +27,7 @@ use Exception as exception,
* Answer
*
* @uses question
* @package mirzaev\deeproots\models
* @package deeproots\deeproots\models
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>

View File

@ -2,10 +2,10 @@
declare(strict_types=1);
namespace mirzaev\deeproots\models;
namespace deeproots\deeproots\models;
// Files of the project
use mirzaev\deeproots\models\core;
use deeproots\deeproots\models\core;
// Svoboda time
use svoboda\time\statement as svoboda;
@ -27,7 +27,7 @@ use Exception as exception,
/**
* Connection between account::class and telegram::class
*
* @package mirzaev\deeproots\models
* @package deeproots\deeproots\models
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace mirzaev\deeproots\models;
namespace deeproots\deeproots\models;
// Framework for PHP
use mirzaev\minimal\model,
@ -14,7 +14,7 @@ use exception;
/**
* Models core
*
* @package mirzaev\deeproots\models
* @package deeproots\deeproots\models
*
* @method void __construct() Constructor
*
@ -41,4 +41,3 @@ class core extends model
{
}
}

View File

@ -2,14 +2,14 @@
declare(strict_types=1);
namespace mirzaev\deeproots\models\enumerations;
namespace deeproots\deeproots\models\enumerations;
/**
* Language
*
* Types of languages by ISO 639-1 standart @deprecated
*
* @package mirzaev\deeproots\models\enumerations
* @package deeproots\deeproots\models\enumerations
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>

View File

@ -2,12 +2,12 @@
declare(strict_types=1);
namespace mirzaev\deeproots\models;
namespace deeproots\deeproots\models;
// Files of the project
use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\question\localization,
mirzaev\deeproots\models\enumerations\language;
use deeproots\deeproots\models\core,
deeproots\deeproots\models\question\localization,
deeproots\deeproots\models\enumerations\language;
// Svoboda time
use svoboda\time\statement as svoboda;
@ -27,7 +27,7 @@ use Exception as exception,
* Question
*
* @uses localization
* @package mirzaev\deeproots\models
* @package deeproots\deeproots\models
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>

View File

@ -2,12 +2,12 @@
declare(strict_types=1);
namespace mirzaev\deeproots\models\question;
namespace deeproots\deeproots\models\question;
// Files of the project
use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\question,
mirzaev\deeproots\models\enumerations\language;
use deeproots\deeproots\models\core,
deeproots\deeproots\models\question,
deeproots\deeproots\models\enumerations\language;
// Svoboda time
use svoboda\time\statement as svoboda;
@ -27,7 +27,7 @@ use Exception as exception,
* Question localization
*
* @uses question
* @package mirzaev\deeproots\models\question
* @package deeproots\deeproots\models\question
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>

View File

@ -0,0 +1,192 @@
<?php
declare(strict_types=1);
namespace deeproots\deeproots\models;
// Files of the project
use deeproots\deeproots\models\core,
deeproots\deeproots\models\account\localization;
// Svoboda time
use svoboda\time\statement as svoboda;
// Baza database
use mirzaev\baza\database,
mirzaev\baza\column,
mirzaev\baza\record,
mirzaev\baza\enumerations\encoding,
mirzaev\baza\enumerations\type;
// Framework for Telegram
use Zanzara\Telegram\Type\User as model;
// Built-in libraries
use Exception as exception,
RuntimeException as exception_runtime;
/**
* Telegram account
*
* @package deeproots\deeproots\models
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/
final class telegram extends core
{
/**
* File
*
* @var string $database Path to the database file
*/
protected string $file = DATABASES . DIRECTORY_SEPARATOR . 'telegram.baza';
/**
* Database
*
* @var database $database The database
*/
public protected(set) database $database;
/**
* Constructor
*
* @return void
*/
public function __construct()
{
// Initializing the database
$this->database = new database()
->encoding(encoding::utf8)
->columns(
new column('identifier', type::integer_unsigned),
new column('domain', type::string, ['length' => 32]),
new column('name_first', type::string, ['length' => 64]),
new column('name_second', type::string, ['length' => 64]),
new column('language', type::string, ['length' => 2]),
new column('robot', type::char),
new column('updated', type::integer_unsigned),
new column('created', type::integer_unsigned)
)
->connect($this->file);
}
/**
* Initialize
*
* Searches for the telegram account record in the database, and if it does not find it, then create
*
* @param model $telegram The telegram account
*
* @throws exception_runtime if update the telegram account record in the database by the telegram account values
* @throws exception_runtime if failed to find the created telegram account
* @throws exception_runtime if failed to create the telegram account
*
* @return record The telegram account record from the database
*/
public function initialize(model $telegram): record
{
// Searching for the account in the database
$account = $this->database->read(filter: fn(record $record) => $record->identifier === $telegram->getId(), amount: 1)[0] ?? null;
if ($account instanceof record) {
// Found the telegram account record
if (
$account->name_first !== $telegram->getFirstName() ||
$account->name_second !== $telegram->getLastName() ||
$account->domain !== $telegram->getUsername()
) {
// The telegram account was updated
// Updating the account in the database
$updated = $this->database->read(
filter: fn(record $record) => $record->identifier === $telegram->getId(),
update: function (record &$record) use ($telegram){
// Writing new values into the record
$record->name_first = $telegram->getFirstName();
$record->name_second = $telegram->getLastName();
$record->domain = $telegram->getUsername();
$record->updated = svoboda::timestamp();
},
amount: 1
)[0] ?? null;
if ($updated instanceof record && $updated->values() !== $account->values()) {
// Updated the account in the database
// Exit (success)
return $updated;
} else {
// Not updated the account in the database
// Exit (fail)
throw new exception_runtime('Failed to update the account record in the database by the telegram account values');
}
}
// Exit (success)
return $account;
} else {
// Not found the account record
if ($this->create($telegram)) {
// Created the account
// Searching for the created telegram account in the database
$account = $this->database->read(filter: fn(record $record) => $record->identifier === $telegram->getId(), amount: 1)[0] ?? null;
if ($account instanceof record) {
// Found the created telegram account
// Exit (success)
return $account;
} else {
// Not found the created telegram account
// Exit (fail)
throw new exception_runtime('Failed to find the created telegram account');
}
} else {
// Not created the telegram account
// Exit (fail)
throw new exception_runtime('Failed to create the telegram account');
}
}
}
/**
* Create
*
* Creates the account record in the database
*
* @param model $telegram The telegram account
*
* @return int|false The record identifier, if created
*/
public function create(model $telegram): int|false
{
// Initializing the identifier
$identifier = (int) $telegram->getId();
// Initializing the record
$record = $this->database->record(
$identifier,
$telegram->getUsername(),
$telegram->getFirstName(),
$telegram->getLastName(),
$telegram->getLanguageCode(),
(int) $telegram->isBot(),
svoboda::timestamp(),
svoboda::timestamp()
);
// Creating the record in the database
$created = $this->database->write($record);
// Exit (success)
return $created ? $identifier : false;
}
}

View File

@ -2,13 +2,13 @@
declare(strict_types=1);
namespace mirzaev\deeproots\models\telegram\buttons\question;
namespace deeproots\deeproots\models\telegram\buttons\question;
// Files of the project
use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\question,
mirzaev\deeproots\models\telegram\processes\question\search as process_question_search,
mirzaev\deeproots\models\enumerations\membership\status;
use deeproots\deeproots\models\core,
deeproots\deeproots\models\question,
deeproots\deeproots\models\telegram\processes\question\search as process_question_search,
deeproots\deeproots\models\enumerations\membership\status;
// Framework for Telegram
use Zanzara\Context as context,
@ -23,7 +23,7 @@ use mirzaev\baza\record;
/**
* Telegram system question search buttons
*
* @package mirzaev\deeproots\models\telegram\buttons\question
* @package deeproots\deeproots\models\telegram\buttons\question
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
@ -54,7 +54,7 @@ final class search extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -144,7 +144,7 @@ final class search extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -234,7 +234,7 @@ final class search extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -324,7 +324,7 @@ final class search extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -414,7 +414,7 @@ final class search extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -504,7 +504,7 @@ final class search extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {

View File

@ -0,0 +1,741 @@
<?php
declare(strict_types=1);
namespace deeproots\deeproots\models\telegram;
// Files of the project
use deeproots\deeproots\models\core,
deeproots\deeproots\models\account,
deeproots\deeproots\models\question,
deeproots\deeproots\models\question\localization as question_localization,
deeproots\deeproots\models\answer,
deeproots\deeproots\models\telegram\processes\language\select as process_language_select,
deeproots\deeproots\models\enumerations\language;
// Framework for Telegram
use Zanzara\Context as context,
Zanzara\Telegram\Type\Message as message,
Zanzara\Telegram\Type\Input\InputFile as file_input;
// Baza database
use mirzaev\baza\record;
/**
* Telegram commands
*
* @package deeproots\deeproots\models\telegram
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/
final class commands extends core
{
/**
* Menu
*
* Response for the commands: "/start", '/menu'
*
* @param context $context Request data from Telegram
*
* @return void
*/
public static function menu(context $context): void
{
// Initializing the account
$account = $context->get('account');
if ($account instanceof record) {
// Initialized the account
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
// Initialized localization
// Initializing the title
$title = '📋 *' . $localization['menu_title'] . '*';
// Sending the message
$context->sendMessage(
<<<TXT
$title
TXT,
[
'reply_markup' => [
'inline_keyboard' => [
[
[
'text' => '🧠 ' . $localization['menu_button_start'],
'callback_data' => 'projects'
]
],
[
[
'text' => '📈 ' . $localization['menu_button_rating'],
'callback_data' => 'rating'
],
[
'text' => '💰 ' . $localization['menu_button_balance'],
'callback_data' => 'balance'
]
]
],
'disable_notification' => true,
'remove_keyboard' => true
],
]
)->then(function (message $message) use ($context, $localization, $account) {
// Sended the message
if (
$account->authorized_system_accounts ||
$account->authorized_system_questions ||
$account->authorized_system_settings
) {
// Found at least one system authorization
// Initializing the keyboard buffer
$keyboard = [];
if ($account->authorized_system_accounts) {
// Authorized to accounts
// Generating the button and writing into the keyboard buffer
$keyboard[] = [
[
'text' => '🐣 ' . $localization['menu_button_system_accounts'],
'callback_data' => 'system_accounts'
]
];
}
if ($account->authorized_system_questions) {
// Authorized to questions
// Generating the button and writing into the keyboard buffer
$keyboard[] = [
[
'text' => '🗂 ' . $localization['menu_button_system_questions'],
'callback_data' => 'system_questions'
]
];
}
if ($account->authorized_system_settings) {
// Authorized to system settings
// Generating the button and writing into the keyboard buffer
$keyboard[] = [
[
'text' => '⚙️ ' . $localization['menu_button_system_settings'],
'callback_data' => 'system_settings'
]
];
}
// Sending the message
$context->sendMessage(
'🛠 ' . $localization['menu_system_authorized'],
[
'reply_markup' => [
'inline_keyboard' => $keyboard,
'disable_notification' => true,
'remove_keyboard' => true
],
]
);
}
});
} else {
// Not initialized localization
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize localization*')
->then(function (message $message) use ($context) {
// Sended the message
// Ending the conversation process
$context->endConversation();
});
}
} else {
// Not initialized the account
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize the account*')
->then(function (message $message) use ($context) {
// Sended the message
// Ending the conversation process
$context->endConversation();
});
}
}
/**
* Account
*
* Responce for the command: "/account"
*
* Sends information about account with menu
*
* @param context $context Request data from Telegram
*
* @return void
*/
public static function account(context $context): void
{
// Initializing the telegram account
$telegram = $context->get('telegram');
if ($telegram instanceof record) {
// Initialized the telegram account
// Initializing the account
$account = $context->get('account');
if ($account instanceof record) {
// Initialized the account
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
// Initialized localization
// Initializing title for the message
$title = '🫵 ' . $localization['account_title'];
// Initializing the account identifier row for the message
$identifier = '*' . $localization['account_identifier'] . ":* $account->identifier \($telegram->identifier\)";
// Declaring buufer of rows about authorizations
$authorizations = '';
// Initializing rows about authorization
foreach ($account->values() as $key => $value) {
// Iterating over account parameters
if (str_starts_with($key, 'authorized_')) {
// Iterating over account authorizations
if (str_starts_with($key, 'authorized_system_') && $value) {
// A system authorization
// Writing into buffer of rows about authorizations
$authorizations .= '✅ ⚠️ *' . ($localization["account_$key"] ?? $key) . ':* ' . $localization['yes'] . "\n";
} else {
// Not a system authorization
// Writing into buffer of rows about authorizations
$authorizations .= ($value ? '✅' : '❎') . ' *' . ($localization["account_$key"] ?? $key) . ':* ' . ($value ? $localization['yes'] : $localization['no']) . "\n";
}
}
}
// Trimming the last line break character
$authorizations = trim($authorizations, "\n");
// Sending the message
$context->sendMessage(
<<<TXT
$title
$identifier
$authorizations
TXT
);
} else {
// Not initialized localization
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize localization*')
->then(function (message $message) use ($context) {
// Sended the message
// Ending the conversation process
$context->endConversation();
});
}
} else {
// Not initialized the account
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize the account*')
->then(function (message $message) use ($context) {
// Sended the message
// Ending the conversation process
$context->endConversation();
});
}
} else {
// Not initialized the telegram account
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize the telegram account*')
->then(function (message $message) use ($context) {
// Sended the message
// Ending the conversation process
$context->endConversation();
});
}
}
/**
* Language
*
* Responce for the command: "/language"
*
* Send the language selection menu
*
* @param context $context Request data from Telegram
*
* @return void
*/
public static function language(context $context): void
{
// Initializing the account
$account = $context->get('account');
if ($account instanceof record) {
// Initialized the account
// Initializing language
$language = $context->get('language');
if ($language instanceof language) {
// Initialized language
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
// Initialized localization
// Sending the language selection
process_language_select::menu(
context: $context,
prefix: 'settings_language_',
title: '🌏 *' . $localization['settings_select_language_title'] . '*',
description: '🌏 *' . $localization['settings_select_language_description'] . '*'
);
} else {
// Not initialized localization
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize localization*')
->then(function (message $message) use ($context) {
// Sended the message
// Ending the conversation process
$context->endConversation();
});
}
} else {
// Not initialized language
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize language*')
->then(function (message $message) use ($context) {
// Sended the message
// Ending the conversation process
$context->endConversation();
});
}
} else {
// Not initialized the account
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize the account*')
->then(function (message $message) use ($context) {
// Sended the message
// Ending the conversation process
$context->endConversation();
});
}
}
/**
* Repository
*
* Responce for the command: "/repository"
*
* Sends information about project and menu
*
* @param context $context Request data from Telegram
*
* @return void
*/
public static function repository(context $context): void
{
// Initializing the account
$account = $context->get('account');
if ($account instanceof record) {
// Initialized the account
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
// Initialized localization
// Initializing title of the message
$title = '🏛️ ' . $localization['repository_title'];
// Sending the message
$context->sendMessage($title . "\n\n" . $localization['repository_text'], [
'reply_markup' => [
'inline_keyboard' => [
[
[
'text' => '🏛️ ' . $localization['repository_button_code'],
'url' => 'https://git.mirzaev.sexy/mirzaev/deeproots'
]
],
[
[
'text' => '⚠️ ' . $localization['repository_button_issues'],
'url' => 'https://git.mirzaev.sexy/mirzaev/deeproots/issues'
],
[
'text' => '🌱 ' . $localization['repository_button_suggestions'],
'url' => 'https://git.mirzaev.sexy/mirzaev/deeproots/issues'
]
]
],
'remove_keyboard' => true,
'disable_notification' => true
],
'link_preview_options' => [
'is_disabled' => true
]
]);
} else {
// Not initialized localization
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize localization*')
->then(function (message $message) use ($context) {
// Ending the conversation process
$context->endConversation();
});
}
} else {
// Not initialized the account
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize the account*')
->then(function (message $message) use ($context) {
// Ending the conversation process
$context->endConversation();
});
}
}
/**
* Author
*
* Responce for the command: "/author"
*
* Sends
*
* @param context $context Request data from Telegram
*
* @return void
*/
public static function author(context $context): void
{
// Initializing the account
$account = $context->get('account');
if ($account instanceof record) {
// Initialized the account
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
// Initialized localization
// Initializing title of the message
$title = '👽 ' . $localization['author_title'];
// Sending the message
$context->sendMessage($title . "\n\n" . $localization['author_text'], [
'reply_markup' => [
'inline_keyboard' => [
[
[
'text' => '📚 ' . $localization['author_button_neurojournal'],
'url' => 'https://mirzaev.sexy'
],
[
'text' => '🤟 ' . $localization['author_button_projects'],
'url' => 'https://git.svoboda.works/mirzaev?tab=activity'
]
],
[
[
'text' => '✖️ ' . $localization['author_button_twitter'],
'url' => 'https://x.com/mirzaev_sexy'
],
[
'text' => '🦋 ' . $localization['author_button_bluesky'],
'url' => 'https://bsky.app/profile/mirzaev.bsky.social'
],
[
'text' => '⛓️ ' . $localization['author_button_bastyon'],
'url' => 'https://bsky.app/profile/mirzaev.bsky.social'
]
],
[
[
'text' => '🇺🇸 ' . $localization['author_button_youtube_english'],
'url' => 'https://www.youtube.com/@MIRZAEV'
],
[
'text' => '🇷🇺 ' . $localization['author_button_youtube_russian'],
'url' => 'https://www.youtube.com/@MIRZAEV'
]
],
[
[
'text' => '✉️ ' . $localization['author_button_message'],
'url' => 'https://t.me/mirzaev_sexy'
]
]
],
'remove_keyboard' => true,
'disable_notification' => true
],
'link_preview_options' => [
'is_disabled' => true
]
]);
} else {
// Not initialized localization
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize localization*')
->then(function (message $message) use ($context) {
// Ending the conversation process
$context->endConversation();
});
}
} else {
// Not initialized the account
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize the account*')
->then(function (message $message) use ($context) {
// Ending the conversation process
$context->endConversation();
});
}
}
/**
* Society
*
* Responce for the command: "/society"
*
* Sends the "mushroom" image and the localized text "why so shroomious"
*
* @param context $context Request data from Telegram
*
* @return void
*/
public static function society(context $context): void
{
// Initializing the account
$account = $context->get('account');
if ($account instanceof record) {
// Initialized the account
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
// Initialized localization
// Sending the message
$context->sendPhoto(
new file_input(STORAGE . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'mushroom.jpg'),
[
'caption' => $localization['why_so_shroomious'],
'disable_notification' => true
]
);
} else {
// Not initialized localization
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize localization*')
->then(function (message $message) use ($context) {
// Sended the message
// Ending the conversation process
$context->endConversation();
});
}
} else {
// Not initialized the account
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize the account*')
->then(function (message $message) use ($context) {
// Sended the message
// Ending the conversation process
$context->endConversation();
});
}
}
/**
* Questions (system)
*
* Sends questions. answers and localizations management menu
*
* @param context $context Request data from Telegram
*
* @return void
*/
public static function system_questions(context $context): void
{
// Initializing the account
$account = $context->get('account');
if ($account instanceof record) {
// Initialized the account
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
// Initialized localization
// Initializing the question model
$model_question = new question();
// Counting questions
$questions = $model_question->database->count();
// Initializing the answer model
$model_answer = new answer();
// Counting answers
$answers = $model_answer->database->count();
// Declaring the localizations amounts buffer
$localizations = [];
// Declaring the questions list
$list = '';
foreach (language::cases() as $case) {
// Iterating over language
// Initializing the localization model by the language
$model_question_localization = new question_localization(language: $case);
// Counting localizations for the language
$amount = $model_question_localization->database->count();
// Writing into the localizations amounts buffer
$localizations[] = $amount;
// Writing into the questions list
$list .= PHP_EOL . $case->flag() . ' *' . $case->label(language::{$account->language ?? LANGUAGE_DEFAULT} ?? language::{LANGUAGE_DEFAULT}) . ':* ' . $amount;
}
// Deinitializing unnecessary variables
unset($case, $model_question, $model_question_localization, $model_answer, $amount);
// Searching for unique values in uhe buffer of questions localizations amounts
$uniques = array_unique($localizations, SORT_REGULAR);
// Is questions amounts matches?
$matches = count($uniques) === 1;
// Sending the message
$context->sendMessage(
sprintf(
<<<TXT
🗂 *%s*
📄 *%s:* %u
🔏 *%s:* %u
%s
%s
%s
%s
TXT,
$localization['system_questions_title'],
$localization['system_questions_questions'],
$questions,
$localization['system_questions_answers'],
$answers,
$list,
$answers === $questions ? '💯 ' . $localization['system_questions_answers_amount_matches'] : '⚠️ ' . $localization['system_questions_answers_amount_different'],
$matches && $questions === $uniques[0] ? '💯 ' . $localization['system_questions_amount_matches'] : '⚠️ ' . $localization['system_questions_amount_different'],
$matches ? '💯 ' . $localization['system_questions_localizations_amount_matches'] : '⚠️ ' . $localization['system_questions_localizations_amount_different']
),
[
'reply_markup' => [
'inline_keyboard' => [
[
[
'text' => '🔍 ' . $localization['system_questions_button_search'],
'callback_data' => 'system_questions_search'
],
[
'text' => '✏️ ' . $localization['system_questions_button_create'],
'callback_data' => 'system_questions_create'
]
]
],
'remove_keyboard' => true,
'disable_notification' => true
],
'link_preview_options' => [
'is_disabled' => true
]
]
);
} else {
// Not initialized localization
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize localization*')
->then(function (message $message) use ($context) {
// Sended the message
// Ending the conversation process
$context->endConversation();
});
}
} else {
// Not initialized the account
// Sending the message
$context->sendMessage('⚠️ *Failed to initialize the account*')
->then(function (message $message) use ($context) {
// Sended the message
// Ending the conversation process
$context->endConversation();
});
}
}
}

View File

@ -2,13 +2,13 @@
declare(strict_types=1);
namespace mirzaev\deeproots\models\telegram;
namespace deeproots\deeproots\models\telegram;
// Files of the project
use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\account,
mirzaev\deeproots\models\telegram,
mirzaev\deeproots\models\enumerations\language;
use deeproots\deeproots\models\core,
deeproots\deeproots\models\account,
deeproots\deeproots\models\telegram,
deeproots\deeproots\models\enumerations\language;
// Framework for Telegram
use Zanzara\Context as context,
@ -24,7 +24,7 @@ use Error as error;
/**
* Telegram middlewares
*
* @package mirzaev\deeproots\models\telegram
* @package deeproots\deeproots\models\telegram
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>

View File

@ -2,11 +2,11 @@
declare(strict_types=1);
namespace mirzaev\deeproots\models\telegram\processes\language;
namespace deeproots\deeproots\models\telegram\processes\language;
// Files of the project
use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\enumerations\language;
use deeproots\deeproots\models\core,
deeproots\deeproots\models\enumerations\language;
// Framework for Telegram
use Zanzara\Context as context,
@ -16,9 +16,9 @@ use Zanzara\Context as context,
use mirzaev\baza\record;
/**
* Telegram language select
* Telegram language select
*
* @package mirzaev\deeproots\models\telegram\processes\language
* @package deeproots\deeproots\models\telegram\processes\language
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
@ -46,13 +46,13 @@ final class select extends core
if ($account instanceof record) {
// Initialized the account
// Initializing language
// Initializing language
$language = $context->get('language');
if ($language) {
// Initialized language
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {

View File

@ -2,16 +2,16 @@
declare(strict_types=1);
namespace mirzaev\deeproots\models\telegram\processes\question;
namespace deeproots\deeproots\models\telegram\processes\question;
// Files of the project
use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\question,
mirzaev\deeproots\models\question\localization,
mirzaev\deeproots\models\answer,
mirzaev\deeproots\models\enumerations\language,
mirzaev\deeproots\models\telegram\commands,
mirzaev\deeproots\models\telegram\processes\question\search as process_question_search;
use deeproots\deeproots\models\core,
deeproots\deeproots\models\question,
deeproots\deeproots\models\question\localization,
deeproots\deeproots\models\answer,
deeproots\deeproots\models\enumerations\language,
deeproots\deeproots\models\telegram\commands,
deeproots\deeproots\models\telegram\processes\question\search as process_question_search;
// Framework for Telegram
use Zanzara\Context as context,
@ -21,9 +21,9 @@ use Zanzara\Context as context,
use mirzaev\baza\record;
/**
* Question create (system)
* Question create (system)
*
* @package mirzaev\deeproots\models\telegram\processes\question
* @package deeproots\deeproots\models\telegram\processes\question
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
@ -54,13 +54,13 @@ final class create extends core
if ($account instanceof record) {
// Initialized the account
// Initializing language
// Initializing language
$language = $context->get('language');
if ($language instanceof language) {
// Initialized language
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {

View File

@ -2,15 +2,15 @@
declare(strict_types=1);
namespace mirzaev\deeproots\models\telegram\processes\question\localization;
namespace deeproots\deeproots\models\telegram\processes\question\localization;
// Files of the project
use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\question,
mirzaev\deeproots\models\question\localization,
mirzaev\deeproots\models\answer,
mirzaev\deeproots\models\enumerations\language,
mirzaev\deeproots\models\telegram\commands;
use deeproots\deeproots\models\core,
deeproots\deeproots\models\question,
deeproots\deeproots\models\question\localization,
deeproots\deeproots\models\answer,
deeproots\deeproots\models\enumerations\language,
deeproots\deeproots\models\telegram\commands;
// Framework for Telegram
use Zanzara\Context as context,
@ -20,9 +20,9 @@ use Zanzara\Context as context,
use mirzaev\baza\record;
/**
* Question localization create (system)
* Question localization create (system)
*
* @package mirzaev\deeproots\models\telegram\processes\question\localization
* @package deeproots\deeproots\models\telegram\processes\question\localization
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
@ -53,13 +53,13 @@ final class create extends core
if ($account instanceof record) {
// Initialized the account
// Initializing language
// Initializing language
$language = $context->get('language');
if ($language instanceof language) {
// Initialized language
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -161,7 +161,7 @@ final class create extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -252,13 +252,13 @@ final class create extends core
if ($account instanceof record) {
// Initialized the account
// Initializing language
// Initializing language
$language = $context->get('language');
if ($language instanceof language) {
// Initialized language
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -414,13 +414,13 @@ final class create extends core
if ($account instanceof record) {
// Initialized the account
// Initializing language
// Initializing language
$language = $context->get('language');
if ($language) {
// Initialized language
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -572,13 +572,13 @@ final class create extends core
if ($account instanceof record) {
// Initialized the account
// Initializing language
// Initializing language
$language = $context->get('language');
if ($language instanceof language) {
// Initialized language
// Initialized language
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -688,7 +688,7 @@ final class create extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -724,7 +724,7 @@ final class create extends core
$spaces = 0;
foreach ($matches[0] as $match) {
// Iterating over found restricted characters
// Iterating over found restricted characters
if ($match === ' ') {
// Space-character
@ -918,7 +918,7 @@ final class create extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {

View File

@ -2,17 +2,17 @@
declare(strict_types=1);
namespace mirzaev\deeproots\models\telegram\processes\question;
namespace deeproots\deeproots\models\telegram\processes\question;
// Files of the project
use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\question,
mirzaev\deeproots\models\question\localization as question_localization,
mirzaev\deeproots\models\answer,
mirzaev\deeproots\models\enumerations\language,
mirzaev\deeproots\models\telegram\commands,
mirzaev\deeproots\models\telegram\buttons\question\search as buttons_question_search,
mirzaev\deeproots\models\telegram\traits\escape;
use deeproots\deeproots\models\core,
deeproots\deeproots\models\question,
deeproots\deeproots\models\question\localization as question_localization,
deeproots\deeproots\models\answer,
deeproots\deeproots\models\enumerations\language,
deeproots\deeproots\models\telegram\commands,
deeproots\deeproots\models\telegram\buttons\question\search as buttons_question_search,
deeproots\deeproots\models\telegram\traits\escape;
// Baza database
use mirzaev\baza\record;
@ -25,9 +25,9 @@ use Zanzara\Context as context,
use function React\Async\await;
/**
* Question create (system)
* Question create (system)
*
* @package mirzaev\deeproots\models\telegram\processes\question
* @package deeproots\deeproots\models\telegram\processes\question
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
@ -61,13 +61,13 @@ final class search extends core
if ($account instanceof record) {
// Initialized the account
// Initializing language
// Initializing language
$language = $context->get('language');
if ($language instanceof language) {
// Initialized language
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -174,7 +174,7 @@ final class search extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -258,13 +258,13 @@ final class search extends core
if ($account instanceof record) {
// Initialized the account
// Initializing language
// Initializing language
$language = $context->get('language');
if ($language) {
// Initialized language
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -590,7 +590,7 @@ final class search extends core
// Initializing the next page existence status
$next = count($questions) > $page;
// Deleting the additional readed questions
// Deleting the additional readed questions
unset($questions[$page]);
// Sending the message
@ -676,7 +676,7 @@ final class search extends core
}
if ($next) {
// Exists the next page
// Exists the next page
// Sending the message
$context->sendMessage(
@ -835,7 +835,7 @@ final class search extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -919,7 +919,7 @@ final class search extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -951,7 +951,7 @@ final class search extends core
static::search($context);
});
} else if ($button === 'delete') {
// Delete
// Delete
// Writing into the question search process buffer
$search['identifier'] = null;
@ -995,7 +995,7 @@ final class search extends core
$characters = [];
foreach ($matches[0] as $match) {
// Iterating over found restricted characters
// Iterating over found restricted characters
// Writing into the buffer of found restricted characers
$characters[] = $match;
@ -1155,7 +1155,7 @@ final class search extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -1187,7 +1187,7 @@ final class search extends core
static::search($context);
});
} else if ($button === 'delete') {
// Delete
// Delete
// Writing into the question search process buffer
$search['text'] = null;
@ -1348,7 +1348,7 @@ final class search extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -1380,7 +1380,7 @@ final class search extends core
static::search($context);
});
} else if ($button === 'delete') {
// Delete
// Delete
// Writing into the question search process buffer
$search['A'] = null;
@ -1543,7 +1543,7 @@ final class search extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -1575,7 +1575,7 @@ final class search extends core
static::search($context);
});
} else if ($button === 'delete') {
// Delete
// Delete
// Writing into the question search process buffer
$search['B'] = null;
@ -1737,7 +1737,7 @@ final class search extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -1769,7 +1769,7 @@ final class search extends core
static::search($context);
});
} else if ($button === 'delete') {
// Delete
// Delete
// Writing into the question search process buffer
$search['C'] = null;
@ -1931,7 +1931,7 @@ final class search extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
@ -1963,7 +1963,7 @@ final class search extends core
static::search($context);
});
} else if ($button === 'delete') {
// Delete
// Delete
// Writing into the question search process buffer
$search['D'] = null;
@ -2211,7 +2211,7 @@ final class search extends core
unset($case, $model_question, $model_question_localization, $model_answer, $amount); // Exit (success)
return sprintf(
<<<TXT
📄 *%s \#%u*
📄 *%s \#%u*
🔏 *%s:* %s
%s

View File

@ -2,13 +2,13 @@
declare(strict_types=1);
namespace mirzaev\deeproots\models\telegram;
namespace deeproots\deeproots\models\telegram;
// Files of the project
use mirzaev\deeproots\models\core,
mirzaev\deeproots\models\account,
mirzaev\deeproots\models\enumerations\language,
mirzaev\deeproots\models\telegram\middlewares;
use deeproots\deeproots\models\core,
deeproots\deeproots\models\account,
deeproots\deeproots\models\enumerations\language,
deeproots\deeproots\models\telegram\middlewares;
// Framework for Telegram
use Zanzara\Zanzara,
@ -25,7 +25,7 @@ use Error as error;
/**
* Telegram settings
*
* @package mirzaev\deeproots\models\telegram
* @package deeproots\deeproots\models\telegram
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
@ -50,12 +50,12 @@ final class settings extends core
if ($account instanceof record) {
// Initialized the account
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {
// Initialized localization
// Initializing the account model
$model = new account();
@ -81,7 +81,7 @@ final class settings extends core
middlewares::localization($context, new node(function (context $context) use ($account, $updated) {
// Updated localization
// Initializing localization
// Initializing localization
$localization = $context->get('localization');
if ($localization) {

View File

@ -2,12 +2,12 @@
declare(strict_types=1);
namespace mirzaev\deeproots\models\telegram\traits;
namespace deeproots\deeproots\models\telegram\traits;
/**
* Escape
*
* @package mirzaev\deeproots\models\telegram\traits
* @package deeproots\deeproots\models\telegram\traits
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>

Some files were not shown because too many files have changed in this diff Show More