generated from mirzaev/pot
parent
23573e3130
commit
01e3984020
|
@ -30,7 +30,8 @@
|
||||||
"mirzaev/baza": "^3.1.0",
|
"mirzaev/baza": "^3.1.0",
|
||||||
"svoboda/time": "^1.0",
|
"svoboda/time": "^1.0",
|
||||||
"badfarm/zanzara": "^0.9.1",
|
"badfarm/zanzara": "^0.9.1",
|
||||||
"react/filesystem": "^0.1.2"
|
"react/filesystem": "^0.1.2",
|
||||||
|
"react/async": "^4.3"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
!.gitignore
|
||||||
|
*.baza
|
||||||
|
*.php
|
|
@ -5,28 +5,326 @@ return [
|
||||||
// System
|
// System
|
||||||
'svoboda' => 'Svoboda',
|
'svoboda' => 'Svoboda',
|
||||||
'empty' => 'Empty',
|
'empty' => 'Empty',
|
||||||
|
'yes' => 'Yes',
|
||||||
|
'no' => 'No',
|
||||||
|
|
||||||
// Main menu
|
// Main menu
|
||||||
'menu_title' => 'Main menu',
|
'menu_title' => 'Main menu',
|
||||||
'menu_accounts' => 'Accounts',
|
'menu_accounts' => 'Accounts',
|
||||||
'menu_members' => 'Members',
|
'menu_members' => 'Members',
|
||||||
'menu_distributions' => 'Distributions',
|
'menu_distributions' => 'Distributions',
|
||||||
|
'menu_not_syncronized' => 'The database does not synchronize with the blockchain network',
|
||||||
'menu_button_site' => 'Site',
|
'menu_button_site' => 'Site',
|
||||||
'menu_button_map' => 'Map',
|
'menu_button_map' => 'Map',
|
||||||
'menu_button_blog' => 'Blog',
|
'menu_button_blog' => 'Blog',
|
||||||
'menu_button_projects' => 'Projects',
|
'menu_button_projects' => 'Projects',
|
||||||
'menu_button_members' => 'Members',
|
'menu_button_members' => 'Members',
|
||||||
'menu_button_distributions' => 'Distributions',
|
'menu_button_distributions' => 'Distributions',
|
||||||
'menu_button_volunteering' => 'Become a volunteer',
|
|
||||||
'menu_button_message' => 'Send a message',
|
// Members
|
||||||
|
'members_title' => 'Registry of members',
|
||||||
|
'members_description' => 'Member is a person who has any form of affiliation with *Svoboda*',
|
||||||
|
'members_button_search' => 'Search',
|
||||||
|
|
||||||
|
// Members search
|
||||||
|
'member_search_started' => 'Process of the member search started',
|
||||||
|
'member_search_not_started' => 'Process of the member search has not started',
|
||||||
|
'member_search_ended' => 'Process of the member search ended',
|
||||||
|
'member_search_not_localized' => 'Failed to initialize the member account localization',
|
||||||
|
'member_search_not_named' => 'No name',
|
||||||
|
'member_search_status' => 'Status',
|
||||||
|
'member_search_status_2' => 'Member',
|
||||||
|
'member_search_status_1' => 'Planned',
|
||||||
|
'member_search_status_0' => 'Unknown',
|
||||||
|
'member_search_continiued' => 'Process of the member search found and continiued',
|
||||||
|
'member_search_empty' => 'No members found',
|
||||||
|
'member_search_title' => 'Member search',
|
||||||
|
'member_search_distribution' => 'Distribution',
|
||||||
|
'member_search_page_next_exists' => 'There are more members in the registry',
|
||||||
|
'member_search_page_next_not_exists' => 'There are no more members in the registry',
|
||||||
|
'member_search_button_name' => 'Name',
|
||||||
|
'member_search_name_request_title' => 'Enter name',
|
||||||
|
'member_search_name_request_description' => 'Search will be conducted by members names using the Levenshtein function',
|
||||||
|
'member_search_name_request_not_acceptable' => 'Failed to process the name',
|
||||||
|
'member_search_name_request_too_short' => 'Name length must be \>\= 2 and \<\= 128',
|
||||||
|
'member_search_name_request_too_long' => 'Name length must be \>\= 2 and \<\= 128',
|
||||||
|
'member_search_name_request_restricted_characters_title' => "Restricted any characters except letters, dashes and spaces",
|
||||||
|
'member_search_name_request_restricted_characters_description' => "Remove these characters:",
|
||||||
|
'member_search_name_update_success' => 'Name replaced:',
|
||||||
|
'member_search_name_update_fail' => 'Failed to replace name',
|
||||||
|
'member_search_distribution_selection_description' => 'The selected distribution will be used to search for members',
|
||||||
|
'member_search_distribution_update_success' => 'Distribution replaced:',
|
||||||
|
'member_search_distribution_update_fail' => 'Failed to replace distribution',
|
||||||
|
'member_search_status_select_title' => 'Select the member status',
|
||||||
|
'member_search_status_update_success' => 'Status replaced:',
|
||||||
|
'member_search_status_update_fail' => 'Failed to replace status',
|
||||||
|
'member_search_button_start' => 'Start the search',
|
||||||
|
'member_search_button_end' => 'End the search',
|
||||||
|
'member_search_button_page_next' => 'Next page',
|
||||||
|
'member_search_button_message' => 'Message',
|
||||||
|
'member_search_button_distribution' => 'Distribution',
|
||||||
|
'member_search_button_status' => 'Status',
|
||||||
|
'member_search_button_status_2' => 'Member',
|
||||||
|
'member_search_button_status_1' => 'Planned',
|
||||||
|
'member_search_button_status_0' => 'Unknown',
|
||||||
|
|
||||||
// Distributions
|
// Distributions
|
||||||
'distributions_title' => 'Registry of distributions',
|
'distributions_title' => 'Registry of distributions',
|
||||||
'distributions_description' => '*Distribution* is an autonomous cell of Svoboda, representing any type of formation \(for example: commune\), but necessarily inherits the *Vhod* protocol and tied to a location',
|
'distributions_description' => '*Distribution* is an autonomous cell of Svoboda, representing any type of formation \(for example: commune\), but necessarily inherits the *Vhod* protocol and tied to a location',
|
||||||
'distributions_registered' => 'Registered',
|
'distributions_declared' => 'Declared',
|
||||||
'distributions_confirmed' => 'Confirmed',
|
'distributions_recognized' => 'Recognized',
|
||||||
'distributions_button_search' => 'Search',
|
'distributions_button_search' => 'Search',
|
||||||
'distributions_button_register' => 'Registrate',
|
'distributions_button_declare' => 'Declare',
|
||||||
|
|
||||||
|
// Distribution selection
|
||||||
|
/* 'select_distributions_title' => 'Select distribution',
|
||||||
|
'select_distributions_description' => 'The selected distribution will be used in the current process',
|
||||||
|
'select_distribution_button_registrate' => 'Registrate a distribution', */
|
||||||
|
|
||||||
|
// Distribution declaration
|
||||||
|
'distribution_declaration_started' => 'Process of the distribution declaration started',
|
||||||
|
'distribution_declaration_not_started' => 'Process of the distribution declaration has not started',
|
||||||
|
'distribution_declaration_ended' => 'Process of the distribution declaration ended',
|
||||||
|
'distribution_declaration_continiued' => 'Process of the distribution declaration found and continiued',
|
||||||
|
'distribution_declaration_generation' => 'The distribution record generation',
|
||||||
|
'distribution_declaration_created_distribution' => 'Created the distribution record in the database',
|
||||||
|
'distribution_declaration_created_localization' => 'Created the distribution localization record in the database',
|
||||||
|
'distribution_declaration_canceled' => 'Process of the distribution declaration canceled',
|
||||||
|
'distribution_declaration_completed' => 'Process of the distribution declaration completed',
|
||||||
|
'distribution_declaration_not_created_distribution' => 'Failed to create the distribution record in the database',
|
||||||
|
'distribution_declaration_not_created_localization' => 'Failed to create the distribution localization record in the database',
|
||||||
|
'distribution_declaration_button_language' => 'Language',
|
||||||
|
'distribution_declaration_select_language_title' => 'Choose a language',
|
||||||
|
'distribution_declaration_select_language_description' => "The selected language will create a localization for users with the same language\n\nYou can create 1 localization for each language",
|
||||||
|
'distribution_declaration_language_update_success' => 'Language replaced:',
|
||||||
|
'distribution_declaration_language_update_fail' => 'Failed to replace language',
|
||||||
|
'distribution_declaration_button_name' => 'Name',
|
||||||
|
'distribution_declaration_name_request' => 'Enter name',
|
||||||
|
'distribution_declaration_name_request_not_acceptable' => 'Failed to process the name',
|
||||||
|
'distribution_declaration_name_request_too_short' => 'Name length must be \>\= 3 and \<\= 64',
|
||||||
|
'distribution_declaration_name_request_too_long' => 'Name length must be \>\= 3 and \<\= 64',
|
||||||
|
'distribution_declaration_name_request_spaces' => "No more than 2 spaces are allowed",
|
||||||
|
'distribution_declaration_name_request_restricted_characters_title' => "Restricted any characters except letters",
|
||||||
|
'distribution_declaration_name_request_restricted_characters_description' => "Remove these characters:",
|
||||||
|
'distribution_declaration_name_update_success' => 'Name replaced:',
|
||||||
|
'distribution_declaration_name_update_fail' => 'Failed to replace name',
|
||||||
|
'distribution_declaration_button_location' => 'Location',
|
||||||
|
'distribution_declaration_button_location_send' => 'Send location',
|
||||||
|
'distribution_declaration_location_send_title' => 'Send location',
|
||||||
|
'distribution_declaration_location_send_description' => "You now have a button on your main keyboard\nWhen you click on it, you can select a location on the map\n\n*Send latitude and longitude in the format:* 50\.969043, 9\.797588",
|
||||||
|
'distribution_declaration_location_send_not_acceptable' => 'Failed to process the location',
|
||||||
|
'distribution_declaration_location_send_latitude_too_small' => 'Latitude must be \>\= 0 and \<\=90',
|
||||||
|
'distribution_declaration_location_send_latitude_too_big' => 'Latitude must be \>\= 0 and \<\=90',
|
||||||
|
'distribution_declaration_location_send_longitude_too_small' => 'Longitude must be \>\= 0 and \<\=180',
|
||||||
|
'distribution_declaration_location_send_longitude_too_big' => 'Longitude must be \>\= 0 and \<\=180',
|
||||||
|
'distribution_declaration_location_update_success' => 'Location replaced:',
|
||||||
|
'distribution_declaration_location_update_fail' => 'Failed to replace location',
|
||||||
|
'distribution_declaration_button_confirm' => 'Confirm',
|
||||||
|
'distribution_declaration_button_cancel' => 'Cancel',
|
||||||
|
|
||||||
|
// Distribution localization
|
||||||
|
'distribution_localization_started' => 'declaration of the distribution process started',
|
||||||
|
'distribution_localization_continiued' => 'declaration of the distribution process found and continiued',
|
||||||
|
'distribution_localization_created' => 'Created the distribution localization record in the database',
|
||||||
|
'distribution_localization_not_created' => 'Failed to create the distribution localization record in the database',
|
||||||
|
'distribution_localization_select_language_title' => 'Choose a language',
|
||||||
|
'distribution_localization_select_language_description' => "The selected language will create a localization for users with the same language\n\nYou can create 1 localization for each language",
|
||||||
|
|
||||||
|
// Distribution search
|
||||||
|
'distribution_search_started' => 'Process of the distribution search started',
|
||||||
|
'distribution_search_not_started' => 'Process of the distribution search has not started',
|
||||||
|
'distribution_search_ended' => 'Process of the distribution search ended',
|
||||||
|
'distribution_search_not_localized' => 'Failed to initialize the distribution localization',
|
||||||
|
'distribution_search_not_named' => 'No name',
|
||||||
|
'distribution_search_continiued' => 'Process of the distribution search found and continiued',
|
||||||
|
'distribution_search_empty' => 'No distributions found',
|
||||||
|
'distribution_search_title' => 'Distribution search',
|
||||||
|
'distribution_search_members' => 'Members',
|
||||||
|
'distribution_search_recognized' => 'Recognized',
|
||||||
|
'distribution_search_planners' => 'Planners',
|
||||||
|
'distribution_search_volunteers' => 'Volunteers',
|
||||||
|
'distribution_search_messages' => 'Messages',
|
||||||
|
'distribution_search_location' => 'Location',
|
||||||
|
'distribution_search_page_next_exists' => 'There are more distributions in the registry',
|
||||||
|
'distribution_search_page_next_not_exists' => 'There are no more distributions in the registry',
|
||||||
|
'distribution_search_button_name' => 'Name',
|
||||||
|
'distribution_search_name_request_title' => 'Enter name',
|
||||||
|
'distribution_search_name_request_description' => 'Search will be conducted by distributions names using the Levenshtein function',
|
||||||
|
'distribution_search_name_request_not_acceptable' => 'Failed to process the name',
|
||||||
|
'distribution_search_name_request_too_short' => 'Name length must be \>\= 3 and \<\= 64',
|
||||||
|
'distribution_search_name_request_too_long' => 'Name length must be \>\= 3 and \<\= 64',
|
||||||
|
'distribution_search_name_request_restricted_characters_title' => "Restricted any characters except letters",
|
||||||
|
'distribution_search_name_request_restricted_characters_description' => "Remove these characters:",
|
||||||
|
'distribution_search_name_update_success' => 'Name replaced:',
|
||||||
|
'distribution_search_name_update_fail' => 'Failed to replace name',
|
||||||
|
'distribution_search_button_location' => 'Location',
|
||||||
|
'distribution_search_button_location_send' => 'Send location',
|
||||||
|
'distribution_search_location_send_title' => 'Send location',
|
||||||
|
'distribution_search_location_send_description' => "You now have a button on your main keyboard\nWhen you click on it, you can select a location on the map\n\n*Send latitude and longitude in the format:* 50\.969043, 9\.797588",
|
||||||
|
'distribution_search_location_send_not_acceptable' => 'Failed to process the location',
|
||||||
|
'distribution_search_location_send_latitude_too_small' => 'Latitude must be \>\= 0 and \<\=90',
|
||||||
|
'distribution_search_location_send_latitude_too_big' => 'Latitude must be \>\= 0 and \<\=90',
|
||||||
|
'distribution_search_location_send_longitude_too_small' => 'Longitude must be \>\= 0 and \<\=180',
|
||||||
|
'distribution_search_location_send_longitude_too_big' => 'Longitude must be \>\= 0 and \<\=180',
|
||||||
|
'distribution_search_location_update_success' => 'Location replaced:',
|
||||||
|
'distribution_search_location_update_fail' => 'Failed to replace location',
|
||||||
|
'distribution_search_button_distance' => 'Distance',
|
||||||
|
'distribution_search_distance_request_title' => 'Enter distance',
|
||||||
|
'distribution_search_distance_request_description' => 'Search will be performed within a radius of this value using the Vincenty formula',
|
||||||
|
'distribution_search_distance_request_not_acceptable' => 'Failed to process the distance',
|
||||||
|
'distribution_search_distance_request_too_short_km' => 'Distance value must be \>\= 0 and \<\= 600',
|
||||||
|
'distribution_search_distance_request_too_long_km' => 'Distance value must be \>\= 0 and \<\= 600',
|
||||||
|
'distribution_search_distance_request_restricted_characters_title' => "Restricted any characters except digitals",
|
||||||
|
'distribution_search_distance_request_restricted_characters_description' => "Delete these characters:",
|
||||||
|
'distribution_search_distance_update_success' => 'Distance replaced:',
|
||||||
|
'distribution_search_distance_update_fail' => 'Failed to replace distance',
|
||||||
|
'distribution_search_button_start' => 'Start the search',
|
||||||
|
'distribution_search_button_end' => 'End the search',
|
||||||
|
'distribution_search_button_page_next' => 'Next page',
|
||||||
|
'distribution_search_button_map' => 'Map',
|
||||||
|
'distribution_search_button_members' => 'Members',
|
||||||
|
'distribution_search_button_volunteers' => 'Volunteers',
|
||||||
|
'distribution_search_button_plan' => 'Plan',
|
||||||
|
'distribution_search_button_unplan' => 'Cancel the planning',
|
||||||
|
'distribution_search_planned' => 'You planned to join to the distribution',
|
||||||
|
'distribution_search_already_planned' => 'You are already planned to join to the distribution',
|
||||||
|
'distribution_search_unplanned' => 'You canceled planning to join to the distribution',
|
||||||
|
'distribution_search_already_unplanned' => 'You are already canceled planning to join to the distribution',
|
||||||
|
'distribution_search_button_join' => 'Join',
|
||||||
|
'distribution_search_button_leave' => 'Leave',
|
||||||
|
'distribution_search_joined_title' => 'You joined the distribution',
|
||||||
|
'distribution_search_joined_description' => 'You have claimed to be a member of the distribution, now you need to get recognition from its members',
|
||||||
|
'distribution_search_already_joined' => 'You are already joined to the distribution',
|
||||||
|
'distribution_search_leaved' => 'You leaved the distribution',
|
||||||
|
'distribution_search_already_leaved' => 'You are already leaved the distribution',
|
||||||
|
'distribution_search_button_message' => 'Message',
|
||||||
|
'distribution_search_km' => 'km',
|
||||||
|
'distribution_search_mi' => 'ml',
|
||||||
|
'distribution_search_member_not_updated' => 'Failed to update the member record in the database',
|
||||||
|
'distribution_search_member_not_created' => 'Failed to create the member record in the database',
|
||||||
|
'distribution_search_distribution_not_initialized' => 'Failed to initalize the distribution',
|
||||||
|
'distribution_search_message_not_initialized' => 'Failed to initialized the message',
|
||||||
|
'distribution_search_another_joined' => 'You are already a member of another distribution',
|
||||||
|
'distribution_search_another_planned' => 'You are already planning to join another distribution',
|
||||||
|
|
||||||
|
// Distribution select
|
||||||
|
'distribution_select_started' => 'Process of the distribution selection started',
|
||||||
|
'distribution_select_not_started' => 'Process of the distribution selection has not started',
|
||||||
|
'distribution_select_ended' => 'Process of the distribution selection ended',
|
||||||
|
'distribution_select_not_localized' => 'Failed to initialize the distribution localization',
|
||||||
|
'distribution_select_not_named' => 'No name',
|
||||||
|
'distribution_select_continiued' => 'Process of the distribution select found and continiued',
|
||||||
|
'distribution_select_empty' => 'No distributions found',
|
||||||
|
'distribution_select_title' => 'Distribution selection',
|
||||||
|
'distribution_select_button_name' => 'Name',
|
||||||
|
'distribution_select_name_request_title' => 'Enter name',
|
||||||
|
'distribution_select_name_request_description' => 'Selection will be conducted by distributions names using the Levenshtein function',
|
||||||
|
'distribution_select_name_request_not_acceptable' => 'Failed to process the name',
|
||||||
|
'distribution_select_name_request_too_short' => 'Name length must be \>\= 3 and \<\= 64',
|
||||||
|
'distribution_select_name_request_too_long' => 'Name length must be \>\= 3 and \<\= 64',
|
||||||
|
'distribution_select_name_request_restricted_characters_title' => "Restricted any characters except letters",
|
||||||
|
'distribution_select_name_request_restricted_characters_description' => "Remove these characters:",
|
||||||
|
'distribution_select_name_update_success' => 'Name replaced:',
|
||||||
|
'distribution_select_name_update_fail' => 'Failed to replace name',
|
||||||
|
'distribution_select_button_location' => 'Location',
|
||||||
|
'distribution_select_button_location_send' => 'Send location',
|
||||||
|
'distribution_select_location_send_title' => 'Send location',
|
||||||
|
'distribution_select_location_send_description' => "You now have a button on your main keyboard\nWhen you click on it, you can select a location on the map\n\n*Send latitude and longitude in the format:* 50\.969043, 9\.797588",
|
||||||
|
'distribution_select_location_send_not_acceptable' => 'Failed to process the location',
|
||||||
|
'distribution_select_location_send_latitude_too_small' => 'Latitude must be \>\= 0 and \<\=90',
|
||||||
|
'distribution_select_location_send_latitude_too_big' => 'Latitude must be \>\= 0 and \<\=90',
|
||||||
|
'distribution_select_location_send_longitude_too_small' => 'Longitude must be \>\= 0 and \<\=180',
|
||||||
|
'distribution_select_location_send_longitude_too_big' => 'Longitude must be \>\= 0 and \<\=180',
|
||||||
|
'distribution_select_location_update_success' => 'Location replaced:',
|
||||||
|
'distribution_select_location_update_fail' => 'Failed to replace location',
|
||||||
|
'distribution_select_page_next_exists' => 'There are more distributions in the registry',
|
||||||
|
'distribution_select_page_next_not_exists' => 'There are no more distributions in the registry',
|
||||||
|
'distribution_select_button_distance' => 'Distance',
|
||||||
|
'distribution_select_distance_request_title' => 'Enter distance',
|
||||||
|
'distribution_select_distance_request_description' => 'Selection will be performed within a radius of this value using the Vincenty formula',
|
||||||
|
'distribution_select_distance_request_not_acceptable' => 'Failed to process the distance',
|
||||||
|
'distribution_select_distance_request_too_short_km' => 'Distance value must be \>\= 0 and \<\= 600',
|
||||||
|
'distribution_select_distance_request_too_long_km' => 'Distance value must be \>\= 0 and \<\= 600',
|
||||||
|
'distribution_select_distance_request_restricted_characters_title' => "Restricted any characters except digitals",
|
||||||
|
'distribution_select_distance_request_restricted_characters_description' => "Delete these characters:",
|
||||||
|
'distribution_select_distance_update_success' => 'Distance replaced:',
|
||||||
|
'distribution_select_distance_update_fail' => 'Failed to replace distance',
|
||||||
|
'distribution_select_button_delete' => 'Delete',
|
||||||
|
'distribution_select_button_cancel' => 'Cancel',
|
||||||
|
'distribution_select_button_page_next' => 'Next page',
|
||||||
|
'distribution_select_button_select' => 'Select',
|
||||||
|
'distribution_select_km' => 'km',
|
||||||
|
'distribution_select_mi' => 'ml',
|
||||||
|
|
||||||
|
// Account
|
||||||
|
'account_title' => 'Account',
|
||||||
|
'account_export' => 'This account can be exported to the Svoboda main blockchain network in the future',
|
||||||
|
'account_data' => "⚠️ Your data may be given to the special services of Russia\nBe careful and think with your head.",
|
||||||
|
'account_security_repository' => 'Information security',
|
||||||
|
'account_security_repository_mirror_github' => 'mirror',
|
||||||
|
'account_authorized_system' => 'Access to the system',
|
||||||
|
'account_authorized_messages' => 'Access to messages',
|
||||||
|
'account_authorized_joins' => 'Access to joins',
|
||||||
|
'account_authorized_settings' => 'Access to settings',
|
||||||
|
'account_authorized_system_accounts' => 'System access to accounts management',
|
||||||
|
'account_authorized_system_distributions' => 'System access to distributions management',
|
||||||
|
'account_authorized_system_members' => 'System access to members management',
|
||||||
|
'account_authorized_system_settings' => 'System access to system settings',
|
||||||
|
'account_button_localizations' => 'Localizations',
|
||||||
|
'account_localization_create_failted_to_initialize_language' => 'Failed to initialize language',
|
||||||
|
|
||||||
|
'account_localization_title' => 'Localizations',
|
||||||
|
'account_localization_amount' => 'Amount',
|
||||||
|
'account_localization_create' => 'Create a localization',
|
||||||
|
'account_localization_create_started' => 'Process of the account localization creating started',
|
||||||
|
'account_localization_create_not_started' => 'Process of the account localization creating not started',
|
||||||
|
'account_localization_create_ended' => 'Process of the account localization creating ended',
|
||||||
|
'account_localization_create_continiued' => 'Process of the account localization creating found and continiued',
|
||||||
|
'account_localization_create_generation' => 'The account localization record generation',
|
||||||
|
'account_localization_create_created' => 'Created the account localization record in the database',
|
||||||
|
'account_localization_create_canceled' => 'Process of the account localization creating canceled',
|
||||||
|
'account_localization_create_completed' => 'Process of the account localization creating completed',
|
||||||
|
'account_localization_create_not_created' => 'Failed to create the account localization record in the database',
|
||||||
|
'account_localization_create_every_language_created' => 'Localizations have already been created for all languages existing in the registry',
|
||||||
|
'account_localization_create_button_language' => 'Language',
|
||||||
|
'account_localization_create_select_language_title' => 'Choose a language',
|
||||||
|
'account_localization_create_select_language_description' => "The selected language will be used when creating the account localization\n\nYou can create 1 localization for each language",
|
||||||
|
'account_localization_create_language_update_success' => 'Language replaced:',
|
||||||
|
'account_localization_create_language_update_fail' => 'Failed to replace language',
|
||||||
|
'account_localization_create_button_name' => 'Name',
|
||||||
|
'account_localization_create_name_request' => 'Enter name',
|
||||||
|
'account_localization_create_name_request_not_acceptable' => 'Failed to process the name',
|
||||||
|
'account_localization_create_name_request_too_short' => 'Name length must be \>\= 2 and \<\= 128',
|
||||||
|
'account_localization_create_name_request_too_long' => 'Name length must be \>\= 2 and \<\= 128',
|
||||||
|
'account_localization_create_name_request_restricted_characters_title' => "Restricted any characters except letters, dashes and spaces",
|
||||||
|
'account_localization_create_name_request_restricted_characters_description' => "Remove these characters:",
|
||||||
|
'account_localization_create_name_update_success' => 'Name replaced:',
|
||||||
|
'account_localization_create_name_update_fail' => 'Failed to replace name',
|
||||||
|
'account_localization_create_button_confirm' => 'Confirm',
|
||||||
|
'account_localization_create_button_cancel' => 'Cancel',
|
||||||
|
'account_localization_update_started' => 'Process of the account localization updating started',
|
||||||
|
'account_localization_update_not_started' => 'Process of the account localization updating not started',
|
||||||
|
'account_localization_update_ended' => 'Process of the account localization updating ended',
|
||||||
|
'account_localization_update_continiued' => 'Process of the account localization updating found and continiued',
|
||||||
|
'account_localization_update_generation' => 'The account localization record generation',
|
||||||
|
'account_localization_update_generation_target' => 'Editing',
|
||||||
|
'account_localization_update_updated' => 'Updated the account localization record in the database',
|
||||||
|
'account_localization_update_canceled' => 'Process of the account localization updating canceled',
|
||||||
|
'account_localization_update_completed' => 'Process of the account localization updating completed',
|
||||||
|
'account_localization_update_not_updated' => 'Failed to update the account localization record in the database',
|
||||||
|
'account_localization_update_not_initialized_localization' => 'Failed to initialize the account localization from the database',
|
||||||
|
'account_localization_update_button_name' => 'Name',
|
||||||
|
'account_localization_update_name_request' => 'Enter name',
|
||||||
|
'account_localization_update_name_request_not_acceptable' => 'Failed to process the name',
|
||||||
|
'account_localization_update_name_request_too_short' => 'Name length must be \>\= 2 and \<\= 128',
|
||||||
|
'account_localization_update_name_request_too_long' => 'Name length must be \>\= 2 and \<\= 128',
|
||||||
|
'account_localization_update_name_request_restricted_characters_title' => "Restricted any characters except letters, dashes and spaces",
|
||||||
|
'account_localization_update_name_request_restricted_characters_description' => "Remove these characters:",
|
||||||
|
'account_localization_update_name_update_success' => 'Name replaced:',
|
||||||
|
'account_localization_update_name_update_fail' => 'Failed to replace name',
|
||||||
|
'account_localization_update_button_confirm' => 'Confirm',
|
||||||
|
'account_localization_update_button_cancel' => 'Cancel',
|
||||||
|
'account_localization_search' => 'search',
|
||||||
|
|
||||||
// Language setting
|
// Language setting
|
||||||
'settings_select_language_title' => 'Select language',
|
'settings_select_language_title' => 'Select language',
|
||||||
|
@ -34,6 +332,11 @@ return [
|
||||||
'settings_language_update_success' => 'Language replaced:',
|
'settings_language_update_success' => 'Language replaced:',
|
||||||
'settings_language_update_fail' => 'Failed to replace language',
|
'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
|
||||||
'repository_title' => 'Repository',
|
'repository_title' => 'Repository',
|
||||||
'repository_text' => <<<TXT
|
'repository_text' => <<<TXT
|
||||||
|
@ -62,127 +365,13 @@ return [
|
||||||
'author_button_youtube_russian' => 'YouTube',
|
'author_button_youtube_russian' => 'YouTube',
|
||||||
'author_button_message' => 'Send a message',
|
'author_button_message' => 'Send a message',
|
||||||
|
|
||||||
// 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',
|
|
||||||
|
|
||||||
// Distribution selection
|
|
||||||
'select_distributions_title' => 'Select distribution',
|
|
||||||
'select_distributions_description' => 'The selected distribution will be used in the current process',
|
|
||||||
'select_distribution_button_registrate' => 'Registrate a distribution',
|
|
||||||
|
|
||||||
// Distribution registration
|
|
||||||
'distribution_registration_started' => 'Process of the distribution registration started',
|
|
||||||
'distribution_registration_not_started' => 'Process of the distribution registration has not started',
|
|
||||||
'distribution_search_ended' => 'Process of the distribution registration ended',
|
|
||||||
'distribution_registration_continiued' => 'Process of the distribution registration found and continiued',
|
|
||||||
'distribution_registration_generation' => 'The distribution record generation',
|
|
||||||
'distribution_registration_created_distribution' => 'Created the distribution record in the database',
|
|
||||||
'distribution_registration_created_localization' => 'Created the distribution localization record in the database',
|
|
||||||
'distribution_registration_canceled' => 'Process of the distribution registration canceled',
|
|
||||||
'distribution_registration_completed' => 'Process of the distribution registration completed',
|
|
||||||
'distribution_registration_not_created_distribution' => 'Failed to create the distribution record in the database',
|
|
||||||
'distribution_registration_not_created_localization' => 'Failed to create the distribution localization record in the database',
|
|
||||||
'distribution_registration_button_language' => 'Language',
|
|
||||||
'distribution_registration_select_language_title' => 'Choose language',
|
|
||||||
'distribution_registration_select_language_description' => "The selected language will create a localization for users with the same language\n\nYou can create 1 localization for each language",
|
|
||||||
'distribution_registration_language_update_success' => 'Language replaced:',
|
|
||||||
'distribution_registration_language_update_fail' => 'Failed to replace language',
|
|
||||||
'distribution_registration_button_name' => 'Name',
|
|
||||||
'distribution_registration_name_request' => 'Enter name',
|
|
||||||
'distribution_registration_name_request_not_acceptable' => 'Failed to process the name',
|
|
||||||
'distribution_registration_name_request_too_short' => 'Name length must be \>\= 3 and \<\= 32',
|
|
||||||
'distribution_registration_name_request_too_long' => 'Name length must be \>\= 3 and \<\= 32',
|
|
||||||
'distribution_registration_name_request_spaces' => "No more than 2 spaces are allowed",
|
|
||||||
'distribution_registration_name_request_restricted_characters_title' => "Restricted any characters except letters",
|
|
||||||
'distribution_registration_name_request_restricted_characters_description' => "Remove these characters:",
|
|
||||||
'distribution_registration_name_update_success' => 'Name replaced:',
|
|
||||||
'distribution_registration_name_update_fail' => 'Failed to replace name',
|
|
||||||
'distribution_registration_button_location' => 'Location',
|
|
||||||
'distribution_registration_button_location_send' => 'Send location',
|
|
||||||
'distribution_registration_location_send_title' => 'Send location',
|
|
||||||
'distribution_registration_location_send_description' => "You now have a button on your main keyboard\nWhen you click on it, you can select a location on the map\n\n*Send latitude and longitude in the format:* 50\.969043, 9\.797588",
|
|
||||||
'distribution_registration_location_send_not_acceptable' => 'Failed to process the location',
|
|
||||||
'distribution_registration_location_send_latitude_too_small' => 'Latitude must be \>\= 0 and \<\=90',
|
|
||||||
'distribution_registration_location_send_latitude_too_big' => 'Latitude must be \>\= 0 and \<\=90',
|
|
||||||
'distribution_registration_location_send_longitude_too_small' => 'Longitude must be \>\= 0 and \<\=180',
|
|
||||||
'distribution_registration_location_send_longitude_too_big' => 'Longitude must be \>\= 0 and \<\=180',
|
|
||||||
'distribution_registration_location_update_success' => 'Location replaced:',
|
|
||||||
'distribution_registration_location_update_fail' => 'Failed to replace location',
|
|
||||||
'distribution_registration_button_confirm' => 'Confirm',
|
|
||||||
'distribution_registration_button_cancel' => 'Cancel',
|
|
||||||
|
|
||||||
// Distribution localization
|
|
||||||
'distribution_localization_started' => 'Registration of the distribution process started',
|
|
||||||
'distribution_localization_continiued' => 'Registration of the distribution process found and continiued',
|
|
||||||
'distribution_localization_created' => 'Created the distribution localization record in the database',
|
|
||||||
'distribution_localization_not_created' => 'Failed to create the distribution localization record in the database',
|
|
||||||
'distribution_localization_select_language_title' => 'Choose language',
|
|
||||||
'distribution_localization_select_language_description' => "The selected language will create a localization for users with the same language\n\nYou can create 1 localization for each language",
|
|
||||||
|
|
||||||
// Distribution search
|
|
||||||
'distribution_search_started' => 'Process of the distribution search started',
|
|
||||||
'distribution_search_not_started' => 'Process of the distribution search has not started',
|
|
||||||
'distribution_search_not_localized' => 'Failed to initialize the distribution localization',
|
|
||||||
'distribution_search_not_named' => 'No name',
|
|
||||||
'distribution_search_continiued' => 'Process of the distribution search found and continiued',
|
|
||||||
'distribution_search_empty' => 'No distributions found',
|
|
||||||
'distribution_search_title' => 'Distribution search',
|
|
||||||
'distribution_search_members' => 'Members',
|
|
||||||
'distribution_search_location' => 'Location',
|
|
||||||
'distribution_search_page_next_exists' => 'There are more distributions in the registry',
|
|
||||||
'distribution_search_page_next_not_exists' => 'There are no more distributions in the registry',
|
|
||||||
'distribution_search_button_text' => 'Text',
|
|
||||||
'distribution_search_text_request_title' => 'Enter search text',
|
|
||||||
'distribution_search_text_request_description' => 'Search will be conducted by names using the Levenshtein function',
|
|
||||||
'distribution_search_text_request_not_acceptable' => 'Failed to process the search text',
|
|
||||||
'distribution_search_text_request_too_short' => 'Search text length must be \>\= 3 and \<\= 64',
|
|
||||||
'distribution_search_text_request_too_long' => 'Search text length must be \>\= 3 and \<\= 64',
|
|
||||||
'distribution_search_text_request_restricted_characters_title' => "Restricted any characters except letters",
|
|
||||||
'distribution_search_text_request_restricted_characters_description' => "Remove these characters:",
|
|
||||||
'distribution_search_text_update_success' => 'Search text replaced:',
|
|
||||||
'distribution_search_text_update_fail' => 'Failed to replace search text',
|
|
||||||
'distribution_search_button_location' => 'Location',
|
|
||||||
'distribution_search_button_location_send' => 'Send location',
|
|
||||||
'distribution_search_location_send_title' => 'Send location',
|
|
||||||
'distribution_search_location_send_description' => "You now have a button on your main keyboard\nWhen you click on it, you can select a location on the map\n\n*Send latitude and longitude in the format:* 50\.969043, 9\.797588",
|
|
||||||
'distribution_search_location_send_not_acceptable' => 'Failed to process the location',
|
|
||||||
'distribution_search_location_send_latitude_too_small' => 'Latitude must be \>\= 0 and \<\=90',
|
|
||||||
'distribution_search_location_send_latitude_too_big' => 'Latitude must be \>\= 0 and \<\=90',
|
|
||||||
'distribution_search_location_send_longitude_too_small' => 'Longitude must be \>\= 0 and \<\=180',
|
|
||||||
'distribution_search_location_send_longitude_too_big' => 'Longitude must be \>\= 0 and \<\=180',
|
|
||||||
'distribution_search_location_update_success' => 'Location replaced:',
|
|
||||||
'distribution_search_location_update_fail' => 'Failed to replace location',
|
|
||||||
'distribution_search_button_distance' => 'Distance',
|
|
||||||
'distribution_search_distance_request_title' => 'Enter distance',
|
|
||||||
'distribution_search_distance_request_description' => 'Search will be performed within a radius of this value using the Vincenty formula',
|
|
||||||
'distribution_search_distance_request_not_acceptable' => 'Failed to process the distance',
|
|
||||||
'distribution_search_distance_request_too_short_km' => 'Distance value must be \>\= 0 and \<\= 600',
|
|
||||||
'distribution_search_distance_request_too_long_km' => 'Distance value must be \>\= 0 and \<\= 600',
|
|
||||||
'distribution_search_distance_request_restricted_characters_title' => "Restricted any characters except digitals",
|
|
||||||
'distribution_search_distance_request_restricted_characters_description' => "Delete these characters:",
|
|
||||||
'distribution_search_distance_update_success' => 'Distance replaced:',
|
|
||||||
'distribution_search_distance_update_fail' => 'Failed to replace distance',
|
|
||||||
'distribution_search_button_confirmed' => 'Confirmed',
|
|
||||||
'distribution_search_button_confirmed_all' => 'All',
|
|
||||||
'distribution_search_confirmed_update_success' => 'Filter by status replaced:',
|
|
||||||
'distribution_search_confirmed_update_fail' => 'Failed to replace filter by status',
|
|
||||||
'distribution_search_button_start' => 'Start the search',
|
|
||||||
'distribution_search_button_end' => 'End the search',
|
|
||||||
'distribution_search_button_page_next' => 'Next page',
|
|
||||||
'distribution_search_button_map' => 'Map',
|
|
||||||
'distribution_search_button_members' => 'Members',
|
|
||||||
'distribution_search_button_message' => 'Send a message',
|
|
||||||
'distribution_search_km' => 'km',
|
|
||||||
'distribution_search_mi' => 'ml',
|
|
||||||
|
|
||||||
// Authorization
|
// Authorization
|
||||||
'not_authorized_system' => 'You do not have access to the system',
|
'not_authorized_system' => 'You do not have access to the system',
|
||||||
'not_authorized_contact' => 'You do not have access to contact with the organisation',
|
'not_authorized_messages' => 'You do not have access to send messages',
|
||||||
'not_authorized_request' => 'You do not have access to requesting to the organisation',
|
'not_authorized_joins' => 'You do not have access to joins',
|
||||||
'not_authorized_settings' => 'You do not have access to the settings',
|
'not_authorized_settings' => 'You do not have access to the settings',
|
||||||
'not_authorized_system_settings' => 'You do not have access to the system settings',
|
'not_authorized_system_settings' => 'You do not have access to the system settings',
|
||||||
|
'not_authorized_system_distributions' => 'You do not have access to distributions administration',
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
'why_so_shroomious' => 'why so shroomious',
|
'why_so_shroomious' => 'why so shroomious',
|
||||||
|
|
|
@ -5,28 +5,323 @@ return [
|
||||||
// Система
|
// Система
|
||||||
'svoboda' => 'Свобода',
|
'svoboda' => 'Свобода',
|
||||||
'empty' => 'Пусто',
|
'empty' => 'Пусто',
|
||||||
|
'yes' => 'Да',
|
||||||
|
'no' => 'Нет',
|
||||||
|
|
||||||
// Главное меню
|
// Главное меню
|
||||||
'menu_title' => 'Главное меню',
|
'menu_title' => 'Главное меню',
|
||||||
'menu_accounts' => 'Аккаунты',
|
'menu_accounts' => 'Аккаунты',
|
||||||
'menu_members' => 'Участники',
|
'menu_members' => 'Участники',
|
||||||
'menu_distributions' => 'Дистрибутивы',
|
'menu_distributions' => 'Дистрибутивы',
|
||||||
|
'menu_not_syncronized' => 'База данных не синхронизируется с блокчейн сетью',
|
||||||
'menu_button_site' => 'Сайт',
|
'menu_button_site' => 'Сайт',
|
||||||
'menu_button_map' => 'Карта',
|
'menu_button_map' => 'Карта',
|
||||||
'menu_button_blog' => 'Блог',
|
'menu_button_blog' => 'Блог',
|
||||||
'menu_button_projects' => 'Проекты',
|
'menu_button_projects' => 'Проекты',
|
||||||
'menu_button_members' => 'Участники',
|
'menu_button_members' => 'Участники',
|
||||||
'menu_button_distributions' => 'Дистрибутивы',
|
'menu_button_distributions' => 'Дистрибутивы',
|
||||||
'menu_button_volunteering' => 'Стать волонтёром',
|
|
||||||
'menu_button_message' => 'Отправить сообщение',
|
// Участники
|
||||||
|
'members_title' => 'Реестр участников',
|
||||||
|
'members_description' => 'Участник \- личность имеющая любую форму взаимоотношений со *Свободой*',
|
||||||
|
'members_button_search' => 'Поиск',
|
||||||
|
|
||||||
|
// Поиск участника
|
||||||
|
'member_search_started' => 'Процесс поиска участника дистрибутива запущен',
|
||||||
|
'member_search_not_started' => 'Процесс поиска участника дистрибутива не запущен',
|
||||||
|
'member_search_ended' => 'Процесс поиска участника дистрибутива завершён',
|
||||||
|
'member_search_not_localized' => 'Не удалось инициализировать локализацию аккаунта участника',
|
||||||
|
'member_search_not_named' => 'Нет имени',
|
||||||
|
'member_search_status' => 'Статус',
|
||||||
|
'member_search_status_2' => 'Участие',
|
||||||
|
'member_search_status_2_emoji' => '🧳',
|
||||||
|
'member_search_status_1' => 'Планирование',
|
||||||
|
'member_search_status_1_emoji' => '📅',
|
||||||
|
'member_search_status_0' => 'Неизвестно',
|
||||||
|
'member_search_status_0_emoji' => '👽',
|
||||||
|
'member_search_continiued' => 'Процесс поиска участника дистрибутива найден и продолжен',
|
||||||
|
'member_search_empty' => 'Не найдены участники дистрибутивов',
|
||||||
|
'member_search_title' => 'Поиск участника дистрибутива',
|
||||||
|
'member_search_distribution' => 'Дистрибутив',
|
||||||
|
'member_search_page_next_exists' => 'В реестре есть ещё участники дистрибутивов',
|
||||||
|
'member_search_page_next_not_exists' => 'В реестре больше нет участников дистрибутивов',
|
||||||
|
'member_search_button_name' => 'Имя',
|
||||||
|
'member_search_name_request_title' => 'Введи имя',
|
||||||
|
'member_search_name_request_description' => 'Поиск будет проводиться по именам участников дистрибутивов с использованием функции Левенштейна',
|
||||||
|
'member_search_name_request_not_acceptable' => 'Не удалось обработать имя',
|
||||||
|
'member_search_name_request_too_short' => 'Длина имени должна быть \>\= 2 и \<\= 128',
|
||||||
|
'member_search_name_request_too_long' => 'Длина имени должна быть \>\= 2 и \<\= 128',
|
||||||
|
'member_search_name_request_restricted_characters_title' => "Запрещены любые символы кроме букв",
|
||||||
|
'member_search_name_request_restricted_characters_description' => "Удали эти символы:",
|
||||||
|
'member_search_name_update_success' => 'Имя заменено:',
|
||||||
|
'member_search_name_update_fail' => 'Не удалось заменить имя',
|
||||||
|
'member_search_button_start' => 'Начать поиск',
|
||||||
|
'member_search_button_end' => 'Завершить поиск',
|
||||||
|
'member_search_button_page_next' => 'Следующая страница',
|
||||||
|
'member_search_button_message' => 'Сообщение',
|
||||||
|
'member_search_button_distribution' => 'Дистрибутив',
|
||||||
|
'member_search_button_status' => 'Статус',
|
||||||
|
'member_search_button_status_2' => 'участие',
|
||||||
|
'member_search_button_status_2_emoji' => '🧳',
|
||||||
|
'member_search_button_status_1' => 'планирование',
|
||||||
|
'member_search_button_status_1_emoji' => '📅',
|
||||||
|
'member_search_button_status_0' => 'неизвестно',
|
||||||
|
'member_search_button_status_0_emoji' => '👽',
|
||||||
|
|
||||||
// Дистрибутивы
|
// Дистрибутивы
|
||||||
'distributions_title' => 'Реестр дистрибутивов',
|
'distributions_title' => 'Реестр дистрибутивов',
|
||||||
'distributions_description' => '*Дистрибутив* \- это автономная ячейка Свободы, являющаяся любым видом формирования \(например: коммуна\), но обязательно наследующая *Vhod* протокол, участвующая в глобальных процессах организации и привязанная к местоположению',
|
'distributions_description' => '*Дистрибутив* \- это автономная ячейка Свободы, являющаяся любым видом формирования \(например: коммуна\), но обязательно наследующая *Vhod* протокол, участвующая в глобальных процессах организации и привязанная к местоположению',
|
||||||
'distributions_registered' => 'Зарегистрировано',
|
'distributions_declared' => 'Объявленные',
|
||||||
'distributions_confirmed' => 'Подтверждено',
|
'distributions_recognized' => 'Признанные',
|
||||||
'distributions_button_search' => 'Поиск',
|
'distributions_button_search' => 'Поиск',
|
||||||
'distributions_button_register' => 'Зарегистрировать',
|
'distributions_button_declare' => 'Объявить',
|
||||||
|
|
||||||
|
// Выбор дистрибутива
|
||||||
|
/* 'select_distributions_title' => 'Выбери дистрибутив',
|
||||||
|
'select_distributions_description' => 'Выбранный дистрибутив будет использован в текущем процесса',
|
||||||
|
'select_distribution_button_registrate' => 'Зарегистрировать дистрибутив', */
|
||||||
|
|
||||||
|
// Объявление дистрибутива
|
||||||
|
'distribution_declaration_started' => 'Процесс объявления дистрибутива запущен',
|
||||||
|
'distribution_declaration_not_started' => 'Процесс объявления дистрибутива не запущен',
|
||||||
|
'distribution_declaration_ended' => 'Процесс объявления дистрибутива завершён',
|
||||||
|
'distribution_declaration_continiued' => 'Процесс объявления дистрибутива найден и продолжен',
|
||||||
|
'distribution_declaration_generation' => 'Генерация записи дистрибутива',
|
||||||
|
'distribution_declaration_created_distribution' => 'Создана запись дистрибутива в базе данных',
|
||||||
|
'distribution_declaration_created_localization' => 'Создана запись локализации дистрибутива в базе данных',
|
||||||
|
'distribution_declaration_canceled' => 'Процесс объявления дистрибутива отменён',
|
||||||
|
'distribution_declaration_completed' => 'Процесс объявления дистрибутива завершен',
|
||||||
|
'distribution_declaration_not_created_distribution' => 'Не удалось создать запись дистрибутива в базе данных',
|
||||||
|
'distribution_declaration_not_created_localization' => 'Не удалось создать запись локализации дистрибутива в базе данных',
|
||||||
|
'distribution_declaration_button_language' => 'Язык',
|
||||||
|
'distribution_declaration_select_language_title' => 'Выбери язык',
|
||||||
|
'distribution_declaration_select_language_description' => "Выбранный язык позволит создать локализацию для пользователей с таким же языком\n\nТы можешь создать 1 локализацию для каждого языка",
|
||||||
|
'distribution_declaration_language_update_success' => 'Язык заменён:',
|
||||||
|
'distribution_declaration_language_update_fail' => 'Не удалось заменить язык',
|
||||||
|
'distribution_declaration_button_name' => 'Название',
|
||||||
|
'distribution_declaration_name_request' => 'Введи название',
|
||||||
|
'distribution_declaration_name_request_not_acceptable' => 'Не удалось обработать название',
|
||||||
|
'distribution_declaration_name_request_too_short' => 'Длина имени должна быть \>\= 3 и \<\= 64',
|
||||||
|
'distribution_declaration_name_request_too_long' => 'Длина имени должна быть \>\= 3 и \<\= 64',
|
||||||
|
'distribution_declaration_name_request_spaces' => "Разрешено использовать не более чем 2 пробела",
|
||||||
|
'distribution_declaration_name_request_restricted_characters_title' => "Запрещены любые символы кроме букв",
|
||||||
|
'distribution_declaration_name_request_restricted_characters_description' => "Удали эти символы:",
|
||||||
|
'distribution_declaration_name_update_success' => 'Название заменено:',
|
||||||
|
'distribution_declaration_name_update_fail' => 'Не удалось заменить название',
|
||||||
|
'distribution_declaration_button_location' => 'Местоположение',
|
||||||
|
'distribution_declaration_button_location_send' => 'Отправить местоположение',
|
||||||
|
'distribution_declaration_location_send_title' => 'Отправь местоположение',
|
||||||
|
'distribution_declaration_location_send_description' => "У тебя появилась кнопка на основной клавиатуре\nПри нажатии на неё можно будет выбрать локацию на карте\n\n*Пришли широту и долготу в формате:* 50\.969043, 9\.797588",
|
||||||
|
'distribution_declaration_location_send_not_acceptable' => 'Не удалось обработать местоположение',
|
||||||
|
'distribution_declaration_location_send_latitude_too_small' => 'Широта должна быть \>\= 0 и \<\=90',
|
||||||
|
'distribution_declaration_location_send_latitude_too_big' => 'Широта должна быть \>\= 0 и \<\=90',
|
||||||
|
'distribution_declaration_location_send_longitude_too_small' => 'Долгота должна быть \>\= 0 и \<\=180',
|
||||||
|
'distribution_declaration_location_send_longitude_too_big' => 'Долгота должна быть \>\= 0 и \<\=180',
|
||||||
|
'distribution_declaration_location_update_success' => 'Местоположение заменено:',
|
||||||
|
'distribution_declaration_location_update_fail' => 'Не удалось заменить местоположение',
|
||||||
|
'distribution_declaration_button_confirm' => 'Подтвердить',
|
||||||
|
'distribution_declaration_button_cancel' => 'Отменить',
|
||||||
|
|
||||||
|
// Локализация дистрибутива
|
||||||
|
'distribution_localization_started' => 'Запущен процесс локализации дистрибутива',
|
||||||
|
'distribution_localization_continiued' => 'Найден и продолжен процесс локализации дистрибутива',
|
||||||
|
'distribution_localization_created' => 'Создана запись локализации дистрибутива в базе данных',
|
||||||
|
'distribution_localization_not_created' => 'Не удалось создать запись локализации дистрибутива в базе данных',
|
||||||
|
'distribution_localization_select_language_title' => 'Выбери язык',
|
||||||
|
'distribution_localization_select_language_description' => "Выбранный язык позволит создать локализацию для пользователей с таким же языком\n\nТы можешь создать 1 локализацию для каждого языка",
|
||||||
|
|
||||||
|
// Поиск дистрибутива
|
||||||
|
'distribution_search_started' => 'Процесс поиска дистрибутива запущен',
|
||||||
|
'distribution_search_not_started' => 'Процесс поиска дистрибутива не запущен',
|
||||||
|
'distribution_search_ended' => 'Процесс поиска дистрибутива завершён',
|
||||||
|
'distribution_search_not_localized' => 'Не удалось инициализировать локализацию дистрибутива',
|
||||||
|
'distribution_search_not_named' => 'Нет названия',
|
||||||
|
'distribution_search_continiued' => 'Процесс поиска дистрибутива найден и продолжен',
|
||||||
|
'distribution_search_empty' => 'Не найдены дистрибутивы',
|
||||||
|
'distribution_search_title' => 'Поиск дистрибутива',
|
||||||
|
'distribution_search_members' => 'Участники',
|
||||||
|
'distribution_search_recognized' => 'Признанные',
|
||||||
|
'distribution_search_planners' => 'Планирующие',
|
||||||
|
'distribution_search_volunteers' => 'Волонтёры',
|
||||||
|
'distribution_search_messages' => 'Сообщения',
|
||||||
|
'distribution_search_location' => 'Местоположение',
|
||||||
|
'distribution_search_page_next_exists' => 'В реестре есть ещё дистрибутивы',
|
||||||
|
'distribution_search_page_next_not_exists' => 'В реестре больше нет дистрибутивов',
|
||||||
|
'distribution_search_button_name' => 'Название',
|
||||||
|
'distribution_search_name_request_title' => 'Введи название',
|
||||||
|
'distribution_search_name_request_description' => 'Поиск будет проводиться по названиям с использованием функции Левенштейна',
|
||||||
|
'distribution_search_name_request_not_acceptable' => 'Не удалось обработать название',
|
||||||
|
'distribution_search_name_request_too_short' => 'Длина названия должна быть \>\= 3 и \<\= 64',
|
||||||
|
'distribution_search_name_request_too_long' => 'Длина названия должна быть \>\= 3 и \<\= 64',
|
||||||
|
'distribution_search_name_request_restricted_characters_title' => "Запрещены любые символы кроме букв",
|
||||||
|
'distribution_search_name_request_restricted_characters_description' => "Удали эти символы:",
|
||||||
|
'distribution_search_name_update_success' => 'Название заменено:',
|
||||||
|
'distribution_search_name_update_fail' => 'Не удалось заменить название',
|
||||||
|
'distribution_search_button_location' => 'Местоположение',
|
||||||
|
'distribution_search_button_location_send' => 'Отправить местоположение',
|
||||||
|
'distribution_search_location_send_title' => 'Отправь местоположение',
|
||||||
|
'distribution_search_location_send_description' => "У тебя появилась кнопка на основной клавиатуре\nПри нажатии на неё можно будет выбрать локацию на карте\n\n*Пришли широту и долготу в формате:* 50\.969043, 9\.797588",
|
||||||
|
'distribution_search_location_send_not_acceptable' => 'Не удалось обработать местоположение',
|
||||||
|
'distribution_search_location_send_latitude_too_small' => 'Широта должна быть \>\= 0 и \<\=90',
|
||||||
|
'distribution_search_location_send_latitude_too_big' => 'Широта должна быть \>\= 0 и \<\=90',
|
||||||
|
'distribution_search_location_send_longitude_too_small' => 'Долгота должна быть \>\= 0 и \<\=180',
|
||||||
|
'distribution_search_location_send_longitude_too_big' => 'Долгота должна быть \>\= 0 и \<\=180',
|
||||||
|
'distribution_search_location_update_success' => 'Местоположение заменено:',
|
||||||
|
'distribution_search_location_update_fail' => 'Не удалось заменить местоположение',
|
||||||
|
'distribution_search_button_distance' => 'Расстояние',
|
||||||
|
'distribution_search_distance_request_title' => 'Введи расстояние',
|
||||||
|
'distribution_search_distance_request_description' => 'Поиск будет производиться в радиусе от этого значения по формуле Винсенти',
|
||||||
|
'distribution_search_distance_request_not_acceptable' => 'Не удалось обработать расстояние',
|
||||||
|
'distribution_search_distance_request_too_short_km' => 'Длина расстояния должна быть \>\= 0 и \<\= 600',
|
||||||
|
'distribution_search_distance_request_too_long_km' => 'Длина расстояния должна быть \>\= 0 и \<\= 600',
|
||||||
|
'distribution_search_distance_request_restricted_characters_title' => "Запрещены любые символы кроме цифр",
|
||||||
|
'distribution_search_distance_request_restricted_characters_description' => "Удали эти символы:",
|
||||||
|
'distribution_search_distance_update_success' => 'Расстояние заменено:',
|
||||||
|
'distribution_search_distance_update_fail' => 'Не удалось заменить расстояние',
|
||||||
|
'distribution_search_button_start' => 'Начать поиск',
|
||||||
|
'distribution_search_button_end' => 'Завершить поиск',
|
||||||
|
'distribution_search_button_page_next' => 'Следующая страница',
|
||||||
|
'distribution_search_button_map' => 'Карта',
|
||||||
|
'distribution_search_button_members' => 'Участники',
|
||||||
|
'distribution_search_button_volunteers' => 'Волонтёры',
|
||||||
|
'distribution_search_button_plan' => 'Запланировать',
|
||||||
|
'distribution_search_button_unplan' => 'Отменить планирование',
|
||||||
|
'distribution_search_planned' => 'Ты запланировал вступление в дистрибутив',
|
||||||
|
'distribution_search_already_planned' => 'Ты уже запланировал вступление в дистрибутив',
|
||||||
|
'distribution_search_unplanned' => 'Ты отменил запланированное вступление в дистрибутив',
|
||||||
|
'distribution_search_already_unplanned' => 'Ты уже отменил запланировал вступление в дистрибутив',
|
||||||
|
'distribution_search_button_join' => 'Присоединиться',
|
||||||
|
'distribution_search_button_leave' => 'Покинуть',
|
||||||
|
'distribution_search_joined_title' => 'Ты вступил в дистрибутив',
|
||||||
|
'distribution_search_joined_description' => 'Ты заявил о том, что являешься участником дистрибутива, теперь тебе надо получить признание от его участников',
|
||||||
|
'distribution_search_already_joined' => 'Ты уже вступил дистрибутив',
|
||||||
|
'distribution_search_leaved' => 'Ты покинул дистрибутив',
|
||||||
|
'distribution_search_already_leaved' => 'Ты уже покинул дистрибутив',
|
||||||
|
'distribution_search_button_message' => 'Сообщение',
|
||||||
|
'distribution_search_km' => 'км',
|
||||||
|
'distribution_search_mi' => 'мл',
|
||||||
|
'distribution_search_member_not_updated' => 'Не удалось обновить запись участника дистрибутива в базе данных',
|
||||||
|
'distribution_search_member_not_created' => 'Не удалось создать запись участника дистрибутива в базе данных',
|
||||||
|
'distribution_search_distribution_not_initialized' => 'Не удалось инициализировать дистрибутив',
|
||||||
|
'distribution_search_message_not_initialized' => 'Не удалось инициализировать сообщение',
|
||||||
|
'distribution_search_another_joined' => 'Ты уже являешься участником другого дистрибутива',
|
||||||
|
'distribution_search_another_planned' => 'Ты уже планируешь вступить в другой дистрибутив',
|
||||||
|
|
||||||
|
// Выбор дистрибутива
|
||||||
|
'distribution_select_started' => 'Процесс выбора дистрибутива запущен',
|
||||||
|
'distribution_select_not_started' => 'Процесс выбора дистрибутива не запущен',
|
||||||
|
'distribution_select_ended' => 'Процесс выбора дистрибутива завершён',
|
||||||
|
'distribution_select_not_localized' => 'Не удалось инициализировать локализацию дистрибутива',
|
||||||
|
'distribution_select_not_named' => 'Нет названия',
|
||||||
|
'distribution_select_continiued' => 'Процесс выбора дистрибутива найден и продолжен',
|
||||||
|
'distribution_select_empty' => 'Не найдены дистрибутивы',
|
||||||
|
'distribution_select_title' => 'Выбор дистрибутива',
|
||||||
|
'distribution_select_page_next_exists' => 'В реестре есть ещё дистрибутивы',
|
||||||
|
'distribution_select_page_next_not_exists' => 'В реестре больше нет дистрибутивов',
|
||||||
|
'distribution_select_button_name' => 'Название',
|
||||||
|
'distribution_select_name_request_title' => 'Введи название',
|
||||||
|
'distribution_select_name_request_description' => 'выбор будет проводиться по названиям с использованием функции Левенштейна',
|
||||||
|
'distribution_select_name_request_not_acceptable' => 'Не удалось обработать название',
|
||||||
|
'distribution_select_name_request_too_short' => 'Длина названия должна быть \>\= 3 и \<\= 64',
|
||||||
|
'distribution_select_name_request_too_long' => 'Длина названия должна быть \>\= 3 и \<\= 64',
|
||||||
|
'distribution_select_name_request_restricted_characters_title' => "Запрещены любые символы кроме букв",
|
||||||
|
'distribution_select_name_request_restricted_characters_description' => "Удали эти символы:",
|
||||||
|
'distribution_select_name_update_success' => 'Название заменено:',
|
||||||
|
'distribution_select_name_update_fail' => 'Не удалось заменить название',
|
||||||
|
'distribution_select_button_location' => 'Местоположение',
|
||||||
|
'distribution_select_button_location_send' => 'Отправить местоположение',
|
||||||
|
'distribution_select_location_send_title' => 'Отправь местоположение',
|
||||||
|
'distribution_select_location_send_description' => "У тебя появилась кнопка на основной клавиатуре\nПри нажатии на неё можно будет выбрать локацию на карте\n\n*Пришли широту и долготу в формате:* 50\.969043, 9\.797588",
|
||||||
|
'distribution_select_location_send_not_acceptable' => 'Не удалось обработать местоположение',
|
||||||
|
'distribution_select_location_send_latitude_too_small' => 'Широта должна быть \>\= 0 и \<\=90',
|
||||||
|
'distribution_select_location_send_latitude_too_big' => 'Широта должна быть \>\= 0 и \<\=90',
|
||||||
|
'distribution_select_location_send_longitude_too_small' => 'Долгота должна быть \>\= 0 и \<\=180',
|
||||||
|
'distribution_select_location_send_longitude_too_big' => 'Долгота должна быть \>\= 0 и \<\=180',
|
||||||
|
'distribution_select_location_update_success' => 'Местоположение заменено:',
|
||||||
|
'distribution_select_location_update_fail' => 'Не удалось заменить местоположение',
|
||||||
|
'distribution_select_button_distance' => 'Расстояние',
|
||||||
|
'distribution_select_distance_request_title' => 'Введи расстояние',
|
||||||
|
'distribution_select_distance_request_description' => 'Поиск будет производиться в радиусе от этого значения по формуле Винсенти',
|
||||||
|
'distribution_select_distance_request_not_acceptable' => 'Не удалось обработать расстояние',
|
||||||
|
'distribution_select_distance_request_too_short_km' => 'Длина расстояния должна быть \>\= 0 и \<\= 600',
|
||||||
|
'distribution_select_distance_request_too_long_km' => 'Длина расстояния должна быть \>\= 0 и \<\= 600',
|
||||||
|
'distribution_select_distance_request_restricted_characters_title' => "Запрещены любые символы кроме цифр",
|
||||||
|
'distribution_select_distance_request_restricted_characters_description' => "Удали эти символы:",
|
||||||
|
'distribution_select_distance_update_success' => 'Расстояние заменено:',
|
||||||
|
'distribution_select_distance_update_fail' => 'Не удалось заменить расстояние',
|
||||||
|
'distribution_select_button_select' => 'Выбрать',
|
||||||
|
'distribution_select_button_cancel' => 'Отменить выбор',
|
||||||
|
'distribution_select_button_page_next' => 'Следующая страница',
|
||||||
|
|
||||||
|
// Аккаунт
|
||||||
|
'account_title' => 'Аккаунт',
|
||||||
|
'account_export' => 'Этот аккаунт может быть экспортирован в основную блокчейн сеть Свободы в будущем',
|
||||||
|
'account_data' => "⚠️ Твои данные могут быть выданы спецслужбам России\nБудь осторожен и думай своей головой",
|
||||||
|
'account_security_repository' => 'Информационная безопасность',
|
||||||
|
'account_security_repository_mirror_github' => 'зеркало',
|
||||||
|
'account_authorized_system' => 'Доступ к системе',
|
||||||
|
'account_authorized_messages' => 'Доступ к сообщениям',
|
||||||
|
'account_authorized_joins' => 'Доступ к вступлениям',
|
||||||
|
'account_authorized_settings' => 'Доступ к изменению настроек',
|
||||||
|
'account_authorized_system_accounts' => 'Системный доступ к управлению аккаунтами',
|
||||||
|
'account_authorized_system_distributions' => 'Системный доступ к управлению дистрибутивами',
|
||||||
|
'account_authorized_system_members' => 'Системный доступ к управлению участниками дистрибутивов',
|
||||||
|
'account_authorized_system_settings' => 'Системный доступ к системным настройкам',
|
||||||
|
'account_button_localizations' => 'Локализации',
|
||||||
|
'account_localization_create_failted_to_initialize_language' => 'Не удалось инициализировать язык',
|
||||||
|
|
||||||
|
'account_localization_title' => 'Локализации',
|
||||||
|
'account_localization_amount' => 'Количество',
|
||||||
|
'account_localization_create' => 'Создать локализацию',
|
||||||
|
'account_localization_create_started' => 'Процесс создания локализации аккаунта запущен',
|
||||||
|
'account_localization_create_not_started' => 'Процесс создания локализации аккаунта не запущен',
|
||||||
|
'account_localization_create_ended' => 'Процесс создания локализации аккаунта завершён',
|
||||||
|
'account_localization_create_continiued' => 'Процесс создания локализации аккаунта найден и продолжен',
|
||||||
|
'account_localization_create_generation' => 'Генерация записи локализации аккаунта',
|
||||||
|
'account_localization_create_created' => 'Создана запись локализации аккаунта в базе данных',
|
||||||
|
'account_localization_create_canceled' => 'Процесс создания локализации аккаунта отменён',
|
||||||
|
'account_localization_create_completed' => 'Процесс создания локализации аккаунта завершен',
|
||||||
|
'account_localization_create_not_created' => 'Не удалось создать запись локализации аккаунта в базе данных',
|
||||||
|
'account_localization_create_every_language_created' => 'Для всех существующих в реестре языков уже были созданы локализации',
|
||||||
|
'account_localization_create_button_language' => 'Язык',
|
||||||
|
'account_localization_create_select_language_title' => 'Выбери язык',
|
||||||
|
'account_localization_create_select_language_description' => "Выбранный язык будет использован при создания локализации аккаунта\n\nТы можешь создать 1 локализацию для каждого языка",
|
||||||
|
'account_localization_create_language_update_success' => 'Язык заменён:',
|
||||||
|
'account_localization_create_language_update_fail' => 'Не удалось заменить язык',
|
||||||
|
'account_localization_create_button_name' => 'Имя',
|
||||||
|
'account_localization_create_name_request' => 'Введи имя',
|
||||||
|
'account_localization_create_name_request_not_acceptable' => 'Не удалось обработать имя',
|
||||||
|
'account_localization_create_name_request_too_short' => 'Длина имени должна быть \>\= 2 и \<\= 128',
|
||||||
|
'account_localization_create_name_request_too_long' => 'Длина имени должна быть \>\= 2 и \<\= 128',
|
||||||
|
'account_localization_create_name_request_restricted_characters_title' => "Запрещены любые символы кроме букв, тире и пробелов",
|
||||||
|
'account_localization_create_name_request_restricted_characters_description' => "Удали эти символы:",
|
||||||
|
'account_localization_create_name_update_success' => 'Имя заменено:',
|
||||||
|
'account_localization_create_name_update_fail' => 'Не удалось заменить имя',
|
||||||
|
'account_localization_create_button_confirm' => 'Подтвердить',
|
||||||
|
'account_localization_create_button_cancel' => 'Отменить',
|
||||||
|
'account_localization_update_started' => 'Процесс обновления локализации аккаунта запущен',
|
||||||
|
'account_localization_update_not_started' => 'Процесс обновления локализации аккаунта не запущен',
|
||||||
|
'account_localization_update_ended' => 'Процесс обновления локализации аккаунта завершён',
|
||||||
|
'account_localization_update_continiued' => 'Процесс обновления локализации аккаунта найден и продолжен',
|
||||||
|
'account_localization_update_generation' => 'Генерация записи локализации аккаунта',
|
||||||
|
'account_localization_update_generation_target' => 'Редактирование',
|
||||||
|
'account_localization_update_updated' => 'Обновлена запись локализации аккаунта в базе данных',
|
||||||
|
'account_localization_update_canceled' => 'Процесс обновления локализации аккаунта отменён',
|
||||||
|
'account_localization_update_completed' => 'Процесс обновления локализации аккаунта завершен',
|
||||||
|
'account_localization_update_not_updated' => 'Не удалось обновить запись локализации аккаунта в базе данных',
|
||||||
|
'account_localization_update_not_initialized_localization' => 'Не удалось инициализировать локализацию аккаунта из базы данных',
|
||||||
|
'account_localization_update_button_name' => 'Имя',
|
||||||
|
'account_localization_update_name_request' => 'Введи имя',
|
||||||
|
'account_localization_update_name_request_not_acceptable' => 'Не удалось обработать имя',
|
||||||
|
'account_localization_update_name_request_too_short' => 'Длина имени должна быть \>\= 2 и \<\= 128',
|
||||||
|
'account_localization_update_name_request_too_long' => 'Длина имени должна быть \>\= 2 и \<\= 128',
|
||||||
|
'account_localization_update_name_request_restricted_characters_title' => "Запрещены любые символы кроме букв, тире и пробелов",
|
||||||
|
'account_localization_update_name_request_restricted_characters_description' => "Удали эти символы:",
|
||||||
|
'account_localization_update_name_update_success' => 'Имя заменено:',
|
||||||
|
'account_localization_update_name_update_fail' => 'Не удалось заменить имя',
|
||||||
|
'account_localization_update_button_confirm' => 'Подтвердить',
|
||||||
|
'account_localization_update_button_cancel' => 'Отменить',
|
||||||
|
'account_localization_search' => 'Поиск',
|
||||||
|
|
||||||
// Настройки языка
|
// Настройки языка
|
||||||
'settings_select_language_title' => 'Выбери язык',
|
'settings_select_language_title' => 'Выбери язык',
|
||||||
|
@ -34,6 +329,11 @@ return [
|
||||||
'settings_language_update_success' => 'Язык заменён:',
|
'settings_language_update_success' => 'Язык заменён:',
|
||||||
'settings_language_update_fail' => 'Не удалось заменить язык',
|
'settings_language_update_fail' => 'Не удалось заменить язык',
|
||||||
|
|
||||||
|
// Выбор языка
|
||||||
|
'select_language_title' => 'Выбери язык',
|
||||||
|
'select_language_description' => 'Выбранный язык будет использован в текущем процессе',
|
||||||
|
'select_language_button_add' => 'Добавить язык',
|
||||||
|
|
||||||
// Репозиторий
|
// Репозиторий
|
||||||
'repository_title' => 'Репозиторий',
|
'repository_title' => 'Репозиторий',
|
||||||
'repository_text' => <<<TXT
|
'repository_text' => <<<TXT
|
||||||
|
@ -62,127 +362,13 @@ return [
|
||||||
'author_button_youtube_russian' => 'YouTube',
|
'author_button_youtube_russian' => 'YouTube',
|
||||||
'author_button_message' => 'Отправить сообщение',
|
'author_button_message' => 'Отправить сообщение',
|
||||||
|
|
||||||
// Выбор языка
|
|
||||||
'select_language_title' => 'Выбери язык',
|
|
||||||
'select_language_description' => 'Выбранный язык будет использован в текущем процессе',
|
|
||||||
'select_language_button_add' => 'Добавить язык',
|
|
||||||
|
|
||||||
// Выбор дистрибутива
|
|
||||||
'select_distributions_title' => 'Выбери дистрибутив',
|
|
||||||
'select_distributions_description' => 'Выбранный дистрибутив будет использован в текущем процесса',
|
|
||||||
'select_distribution_button_registrate' => 'Зарегистрировать дистрибутив',
|
|
||||||
|
|
||||||
// Регистрация дистрибутива
|
|
||||||
'distribution_registration_started' => 'Процесс регистрации дистрибутива запущен',
|
|
||||||
'distribution_registration_not_started' => 'Процесс регистрации дистрибутива не запущен',
|
|
||||||
'distribution_registration_continiued' => 'Процесс регистрации дистрибутива найден и продолжен',
|
|
||||||
'distribution_registration_generation' => 'Генерация записи дистрибутива',
|
|
||||||
'distribution_registration_created_distribution' => 'Создана запись дистрибутива в базе данных',
|
|
||||||
'distribution_registration_created_localization' => 'Создана запись локализации дистрибутива в базе данных',
|
|
||||||
'distribution_registration_canceled' => 'Процесс регистрации дистрибутива отменён',
|
|
||||||
'distribution_registration_completed' => 'Процесс регистрации дистрибутива завершен',
|
|
||||||
'distribution_registration_not_created_distribution' => 'Не удалось создать запись дистрибутива в базе данных',
|
|
||||||
'distribution_registration_not_created_localization' => 'Не удалось создать запись локализации дистрибутива в базе данных',
|
|
||||||
'distribution_registration_button_language' => 'Язык',
|
|
||||||
'distribution_registration_select_language_title' => 'Выбери язык',
|
|
||||||
'distribution_registration_select_language_description' => "Выбранный язык позволит создать локализацию для пользователей с таким же языком\n\nТы можешь создать 1 локализацию для каждого языка",
|
|
||||||
'distribution_registration_language_update_success' => 'Язык заменён:',
|
|
||||||
'distribution_registration_language_update_fail' => 'Не удалось заменить язык',
|
|
||||||
'distribution_registration_button_name' => 'Название',
|
|
||||||
'distribution_registration_name_request' => 'Введи название',
|
|
||||||
'distribution_registration_name_request_not_acceptable' => 'Не удалось обработать название',
|
|
||||||
'distribution_registration_name_request_too_short' => 'Длина имени должна быть \>\= 3 и \<\= 32',
|
|
||||||
'distribution_registration_name_request_too_long' => 'Длина имени должна быть \>\= 3 и \<\= 32',
|
|
||||||
'distribution_registration_name_request_spaces' => "Разрешено использовать не более чем 2 пробела",
|
|
||||||
'distribution_registration_name_request_restricted_characters_title' => "Запрещены любые символы кроме букв",
|
|
||||||
'distribution_registration_name_request_restricted_characters_description' => "Удали эти символы:",
|
|
||||||
'distribution_registration_name_update_success' => 'Название заменено:',
|
|
||||||
'distribution_registration_name_update_fail' => 'Не удалось заменить название',
|
|
||||||
'distribution_registration_button_location' => 'Местоположение',
|
|
||||||
'distribution_registration_button_location_send' => 'Отправить местоположение',
|
|
||||||
'distribution_registration_location_send_title' => 'Отправь местоположение',
|
|
||||||
'distribution_registration_location_send_description' => "У тебя появилась кнопка на основной клавиатуре\nПри нажатии на неё можно будет выбрать локацию на карте\n\n*Пришли широту и долготу в формате:* 50\.969043, 9\.797588",
|
|
||||||
'distribution_registration_location_send_not_acceptable' => 'Не удалось обработать местоположение',
|
|
||||||
'distribution_registration_location_send_latitude_too_small' => 'Широта должна быть \>\= 0 и \<\=90',
|
|
||||||
'distribution_registration_location_send_latitude_too_big' => 'Широта должна быть \>\= 0 и \<\=90',
|
|
||||||
'distribution_registration_location_send_longitude_too_small' => 'Долгота должна быть \>\= 0 и \<\=180',
|
|
||||||
'distribution_registration_location_send_longitude_too_big' => 'Долгота должна быть \>\= 0 и \<\=180',
|
|
||||||
'distribution_registration_location_update_success' => 'Местоположение заменено:',
|
|
||||||
'distribution_registration_location_update_fail' => 'Не удалось заменить местоположение',
|
|
||||||
'distribution_registration_button_confirm' => 'Подтвердить',
|
|
||||||
'distribution_registration_button_cancel' => 'Отменить',
|
|
||||||
|
|
||||||
// Локализация дистрибутива
|
|
||||||
'distribution_localization_started' => 'Запущен процесс локализации дистрибутива',
|
|
||||||
'distribution_localization_continiued' => 'Найден и продолжен процесс локализации дистрибутива',
|
|
||||||
'distribution_localization_created' => 'Создана запись локализации дистрибутива в базе данных',
|
|
||||||
'distribution_localization_not_created' => 'Не удалось создать запись локализации дистрибутива в базе данных',
|
|
||||||
'distribution_localization_select_language_title' => 'Выбери язык',
|
|
||||||
'distribution_localization_select_language_description' => "Выбранный язык позволит создать локализацию для пользователей с таким же языком\n\nТы можешь создать 1 локализацию для каждого языка",
|
|
||||||
|
|
||||||
// Поиск дистрибутива
|
|
||||||
'distribution_search_started' => 'Процесс поиска дистрибутива запущен',
|
|
||||||
'distribution_search_not_started' => 'Процесс поиска дистрибутива не запущен',
|
|
||||||
'distribution_search_ended' => 'Процесс поиска дистрибутива завершён',
|
|
||||||
'distribution_search_not_localized' => 'Не удалось инициализировать локализацию дистрибутива',
|
|
||||||
'distribution_search_not_named' => 'Нет названия',
|
|
||||||
'distribution_search_continiued' => 'Процесс поиска дистрибутива найден и продолжен',
|
|
||||||
'distribution_search_empty' => 'Не найдены дистрибутивы',
|
|
||||||
'distribution_search_title' => 'Поиск дистрибутива',
|
|
||||||
'distribution_search_members' => 'Участники',
|
|
||||||
'distribution_search_location' => 'Местоположение',
|
|
||||||
'distribution_search_page_next_exists' => 'В реестре есть ещё дистрибутивы',
|
|
||||||
'distribution_search_page_next_not_exists' => 'В реестре больше нет дистрибутивов',
|
|
||||||
'distribution_search_button_text' => 'Текст',
|
|
||||||
'distribution_search_text_request_title' => 'Введи текст для поиска',
|
|
||||||
'distribution_search_text_request_description' => 'Поиск будет проводиться по названиям с использованием функции Левенштейна',
|
|
||||||
'distribution_search_text_request_not_acceptable' => 'Не удалось обработать поисковый текст',
|
|
||||||
'distribution_search_text_request_too_short' => 'Длина поскового текста должна быть \>\= 3 и \<\= 64',
|
|
||||||
'distribution_search_text_request_too_long' => 'Длина поискового текста должна быть \>\= 3 и \<\= 64',
|
|
||||||
'distribution_search_text_request_restricted_characters_title' => "Запрещены любые символы кроме букв",
|
|
||||||
'distribution_search_text_request_restricted_characters_description' => "Удали эти символы:",
|
|
||||||
'distribution_search_text_update_success' => 'Поисковый текст заменён:',
|
|
||||||
'distribution_search_text_update_fail' => 'Не удалось заменить поисковый текст',
|
|
||||||
'distribution_search_button_location' => 'Местоположение',
|
|
||||||
'distribution_search_button_location_send' => 'Отправить местоположение',
|
|
||||||
'distribution_search_location_send_title' => 'Отправь местоположение',
|
|
||||||
'distribution_search_location_send_description' => "У тебя появилась кнопка на основной клавиатуре\nПри нажатии на неё можно будет выбрать локацию на карте\n\n*Пришли широту и долготу в формате:* 50\.969043, 9\.797588",
|
|
||||||
'distribution_search_location_send_not_acceptable' => 'Не удалось обработать местоположение',
|
|
||||||
'distribution_search_location_send_latitude_too_small' => 'Широта должна быть \>\= 0 и \<\=90',
|
|
||||||
'distribution_search_location_send_latitude_too_big' => 'Широта должна быть \>\= 0 и \<\=90',
|
|
||||||
'distribution_search_location_send_longitude_too_small' => 'Долгота должна быть \>\= 0 и \<\=180',
|
|
||||||
'distribution_search_location_send_longitude_too_big' => 'Долгота должна быть \>\= 0 и \<\=180',
|
|
||||||
'distribution_search_location_update_success' => 'Местоположение заменено:',
|
|
||||||
'distribution_search_location_update_fail' => 'Не удалось заменить местоположение',
|
|
||||||
'distribution_search_button_distance' => 'Расстояние',
|
|
||||||
'distribution_search_distance_request_title' => 'Введи расстояние',
|
|
||||||
'distribution_search_distance_request_description' => 'Поиск будет производиться в радиусе от этого значения по формуле Винсенти',
|
|
||||||
'distribution_search_distance_request_not_acceptable' => 'Не удалось обработать расстояние',
|
|
||||||
'distribution_search_distance_request_too_short_km' => 'Длина расстояния должна быть \>\= 0 и \<\= 600',
|
|
||||||
'distribution_search_distance_request_too_long_km' => 'Длина расстояния должна быть \>\= 0 и \<\= 600',
|
|
||||||
'distribution_search_distance_request_restricted_characters_title' => "Запрещены любые символы кроме цифр",
|
|
||||||
'distribution_search_distance_request_restricted_characters_description' => "Удали эти символы:",
|
|
||||||
'distribution_search_distance_update_success' => 'Расстояние заменено:',
|
|
||||||
'distribution_search_distance_update_fail' => 'Не удалось заменить расстояние',
|
|
||||||
'distribution_search_button_confirmed' => 'Подтверждённые',
|
|
||||||
'distribution_search_button_confirmed_all' => 'Все',
|
|
||||||
'distribution_search_confirmed_update_success' => 'Фильтр по статусу заменён:',
|
|
||||||
'distribution_search_confirmed_update_fail' => 'Не удалось заменить фильтр по статусу',
|
|
||||||
'distribution_search_button_start' => 'Начать поиск',
|
|
||||||
'distribution_search_button_end' => 'Завершить поиск',
|
|
||||||
'distribution_search_button_page_next' => 'Следующая страница',
|
|
||||||
'distribution_search_button_map' => 'Карта',
|
|
||||||
'distribution_search_button_members' => 'Участники',
|
|
||||||
'distribution_search_button_message' => 'Отправить сообщение',
|
|
||||||
'distribution_search_km' => 'км',
|
|
||||||
'distribution_search_mi' => 'мл',
|
|
||||||
|
|
||||||
// Авторизация
|
// Авторизация
|
||||||
'not_authorized_system' => 'У тебя нет доступа к системе',
|
'not_authorized_system' => 'У тебя нет доступа к системе',
|
||||||
'not_authorized_contact' => 'У тебя нет доступа к коммуникации с организацией',
|
'not_authorized_messages' => 'У тебя нет доступа к сообщениям',
|
||||||
'not_authorized_request' => 'У тебя нет доступа к отправке запросов в организацию',
|
'not_authorized_joins' => 'У тебя нет доступа к вступлениям',
|
||||||
'not_authorized_settings' => 'У тебя нет доступа к настройкам',
|
'not_authorized_settings' => 'У тебя нет доступа к настройкам',
|
||||||
'not_authorized_system_settings' => 'У тебя нет доступа к системным настройкам',
|
'not_authorized_system_settings' => 'У тебя нет доступа к системным настройкам',
|
||||||
|
'not_authorized_system_distributions' => 'У тебя нет доступа к администрированию дистрибутивов',
|
||||||
|
|
||||||
// Прочее
|
// Прочее
|
||||||
'why_so_shroomious' => 'почему такой грибъёзный',
|
'why_so_shroomious' => 'почему такой грибъёзный',
|
||||||
|
|
Binary file not shown.
|
@ -5,7 +5,8 @@ declare(strict_types=1);
|
||||||
namespace svoboda\svoboder\models;
|
namespace svoboda\svoboder\models;
|
||||||
|
|
||||||
// Files of the project
|
// Files of the project
|
||||||
use svoboda\svoboder\models\core;
|
use svoboda\svoboder\models\core,
|
||||||
|
svoboda\svoboder\models\account\localization;
|
||||||
|
|
||||||
// Svoboda time
|
// Svoboda time
|
||||||
use svoboda\time\statement as svoboda;
|
use svoboda\time\statement as svoboda;
|
||||||
|
@ -48,6 +49,13 @@ final class account extends core
|
||||||
*/
|
*/
|
||||||
public protected(set) database $database;
|
public protected(set) database $database;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Localization
|
||||||
|
*
|
||||||
|
* @var localization $localization The localizations implementator
|
||||||
|
*/
|
||||||
|
public protected(set) localization $localization;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
|
@ -67,18 +75,21 @@ final class account extends core
|
||||||
new column('language', type::string, ['length' => 2]),
|
new column('language', type::string, ['length' => 2]),
|
||||||
new column('robot', type::char),
|
new column('robot', type::char),
|
||||||
new column('authorized_system', type::char),
|
new column('authorized_system', type::char),
|
||||||
new column('authorized_contact', type::char),
|
new column('authorized_messages', type::char),
|
||||||
new column('authorized_request', type::char),
|
new column('authorized_joins', type::char),
|
||||||
new column('authorized_settings', type::char),
|
new column('authorized_settings', type::char),
|
||||||
new column('authorized_system_accounts', type::char),
|
new column('authorized_system_accounts', type::char),
|
||||||
new column('authorized_system_distributions', type::char),
|
new column('authorized_system_distributions', type::char),
|
||||||
new column('authorized_system_members', type::char),
|
new column('authorized_system_members', type::char),
|
||||||
/* new column('authorized_system_', type::char), */
|
/* new column('authorized_system_', type::char), */
|
||||||
new column('authorized_system_settings', type::char),
|
new column('authorized_system_settings', type::char),
|
||||||
new column('created', type::integer_unsigned),
|
new column('updated', type::integer_unsigned),
|
||||||
new column('updated', type::integer_unsigned)
|
new column('created', type::integer_unsigned)
|
||||||
)
|
)
|
||||||
->connect($this->file);
|
->connect($this->file);
|
||||||
|
|
||||||
|
// Initializing the localizations implementator
|
||||||
|
$this->localization = new localization;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -201,10 +212,18 @@ final class account extends core
|
||||||
svoboda::timestamp()
|
svoboda::timestamp()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Creating the accound record in the database
|
// Creating the record in the database
|
||||||
$created = $this->database->write($record);
|
$created = $this->database->write($record);
|
||||||
|
|
||||||
// Exit (success)
|
// Exit (success)
|
||||||
return $created ? $identifier : false;
|
return $created ? $identifier : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function localizations(): array|false
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// Exit (fail)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace svoboda\svoboder\models\account;
|
||||||
|
|
||||||
|
// Files of the project
|
||||||
|
use svoboda\svoboder\models\core,
|
||||||
|
svoboda\svoboder\models\enumerations\language;
|
||||||
|
|
||||||
|
// 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 telegram;
|
||||||
|
|
||||||
|
// Built-in libraries
|
||||||
|
use Exception as exception,
|
||||||
|
RuntimeException as exception_runtime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Localization
|
||||||
|
*
|
||||||
|
* @package svoboda\svoboder\models\account
|
||||||
|
*
|
||||||
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||||
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
|
*/
|
||||||
|
final class localization extends core
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* File
|
||||||
|
*
|
||||||
|
* @var string $database Path to the database file
|
||||||
|
*/
|
||||||
|
protected string $file = DATABASES . DIRECTORY_SEPARATOR . 'accounts' . DIRECTORY_SEPARATOR . 'localizations.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('account', type::integer_unsigned),
|
||||||
|
new column('language', type::string, ['length' => 2]),
|
||||||
|
new column('name', type::string, ['length' => 128]),
|
||||||
|
new column('updated', type::integer_unsigned),
|
||||||
|
new column('created', type::integer_unsigned)
|
||||||
|
)
|
||||||
|
->connect($this->file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create
|
||||||
|
*
|
||||||
|
* Creates the account localization record in the database
|
||||||
|
*
|
||||||
|
* @param int $account Identifier of the account
|
||||||
|
* @param language $language Language
|
||||||
|
* @param string $name Name of the account
|
||||||
|
*
|
||||||
|
* @return int|false The record identifier, if created
|
||||||
|
*/
|
||||||
|
public function create(int $account, language $language, string $name): int|false
|
||||||
|
{
|
||||||
|
// Initializing the identifier
|
||||||
|
$identifier = $this->database->count() + 1;
|
||||||
|
|
||||||
|
// Initializing the record
|
||||||
|
$record = $this->database->record(
|
||||||
|
$identifier,
|
||||||
|
$account,
|
||||||
|
$language->name,
|
||||||
|
$name,
|
||||||
|
svoboda::timestamp(),
|
||||||
|
svoboda::timestamp()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Creating the record in the database
|
||||||
|
$created = $this->database->write($record);
|
||||||
|
|
||||||
|
// Exit (success)
|
||||||
|
return $created ? $identifier : false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,7 +5,9 @@ declare(strict_types=1);
|
||||||
namespace svoboda\svoboder\models;
|
namespace svoboda\svoboder\models;
|
||||||
|
|
||||||
// Files of the project
|
// Files of the project
|
||||||
use svoboda\svoboder\models\core;
|
use svoboda\svoboder\models\core,
|
||||||
|
svoboda\svoboder\models\distribution\localization,
|
||||||
|
svoboda\svoboder\models\distribution\message;
|
||||||
|
|
||||||
// Svoboda time
|
// Svoboda time
|
||||||
use svoboda\time\statement as svoboda;
|
use svoboda\time\statement as svoboda;
|
||||||
|
@ -48,6 +50,20 @@ final class distribution extends core
|
||||||
*/
|
*/
|
||||||
public protected(set) database $database;
|
public protected(set) database $database;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Localization
|
||||||
|
*
|
||||||
|
* @var localization $localization The localizations implementator
|
||||||
|
*/
|
||||||
|
public protected(set) localization $localization;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message
|
||||||
|
*
|
||||||
|
* @var localization $localization The messages implementator
|
||||||
|
*/
|
||||||
|
public protected(set) message $message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
|
@ -61,13 +77,18 @@ final class distribution extends core
|
||||||
->columns(
|
->columns(
|
||||||
new column('identifier', type::integer_unsigned),
|
new column('identifier', type::integer_unsigned),
|
||||||
new column('creator', type::integer_unsigned),
|
new column('creator', type::integer_unsigned),
|
||||||
new column('accepted', type::char),
|
|
||||||
new column('latitude', type::float),
|
new column('latitude', type::float),
|
||||||
new column('longitude', type::float),
|
new column('longitude', type::float),
|
||||||
new column('created', type::integer_unsigned),
|
new column('updated', type::integer_unsigned),
|
||||||
new column('updated', type::integer_unsigned)
|
new column('created', type::integer_unsigned)
|
||||||
)
|
)
|
||||||
->connect($this->file);
|
->connect($this->file);
|
||||||
|
|
||||||
|
// Initializing the localizations implementator
|
||||||
|
$this->localization = new localization;
|
||||||
|
|
||||||
|
// Initializing the messages implementator
|
||||||
|
$this->message = new message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,14 +111,13 @@ final class distribution extends core
|
||||||
$record = $this->database->record(
|
$record = $this->database->record(
|
||||||
$identifier,
|
$identifier,
|
||||||
$creator,
|
$creator,
|
||||||
0,
|
|
||||||
$latitude,
|
$latitude,
|
||||||
$longitude,
|
$longitude,
|
||||||
svoboda::timestamp(),
|
svoboda::timestamp(),
|
||||||
svoboda::timestamp()
|
svoboda::timestamp()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Creating the accound record in the database
|
// Creating the record in the database
|
||||||
$created = $this->database->write($record);
|
$created = $this->database->write($record);
|
||||||
|
|
||||||
// Exit (success)
|
// Exit (success)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace svoboda\svoboder\models\localizations;
|
namespace svoboda\svoboder\models\distribution;
|
||||||
|
|
||||||
// Files of the project
|
// Files of the project
|
||||||
use svoboda\svoboder\models\core,
|
use svoboda\svoboder\models\core,
|
||||||
|
@ -26,21 +26,21 @@ use Exception as exception,
|
||||||
RuntimeException as exception_runtime;
|
RuntimeException as exception_runtime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Distribution
|
* Localization
|
||||||
*
|
*
|
||||||
* @package svoboda\svoboder\models\localizations
|
* @package svoboda\svoboder\models\distributions
|
||||||
*
|
*
|
||||||
* @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 distribution extends core
|
final class localization extends core
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* File
|
* File
|
||||||
*
|
*
|
||||||
* @var string $database Path to the database file
|
* @var string $database Path to the database file
|
||||||
*/
|
*/
|
||||||
protected string $file = DATABASES . DIRECTORY_SEPARATOR . 'localizations' . DIRECTORY_SEPARATOR . 'distributions.baza';
|
protected string $file = DATABASES . DIRECTORY_SEPARATOR . 'distributions' . DIRECTORY_SEPARATOR . 'localizations.baza';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database
|
* Database
|
||||||
|
@ -63,9 +63,9 @@ final class distribution extends core
|
||||||
new column('identifier', type::integer_unsigned),
|
new column('identifier', type::integer_unsigned),
|
||||||
new column('distribution', type::integer_unsigned),
|
new column('distribution', type::integer_unsigned),
|
||||||
new column('language', type::string, ['length' => 2]),
|
new column('language', type::string, ['length' => 2]),
|
||||||
new column('name', type::string, ['length' => 32]),
|
new column('name', type::string, ['length' => 64]),
|
||||||
new column('created', type::integer_unsigned),
|
new column('updated', type::integer_unsigned),
|
||||||
new column('updated', type::integer_unsigned)
|
new column('created', type::integer_unsigned)
|
||||||
)
|
)
|
||||||
->connect($this->file);
|
->connect($this->file);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ final class distribution extends core
|
||||||
*
|
*
|
||||||
* @param int $distribution Identifier of the distribution
|
* @param int $distribution Identifier of the distribution
|
||||||
* @param language $language Language
|
* @param language $language Language
|
||||||
* @param string $name Name
|
* @param string $name Name of the distribution
|
||||||
*
|
*
|
||||||
* @return int|false The record identifier, if created
|
* @return int|false The record identifier, if created
|
||||||
*/
|
*/
|
||||||
|
@ -96,7 +96,7 @@ final class distribution extends core
|
||||||
svoboda::timestamp()
|
svoboda::timestamp()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Creating the accound record in the database
|
// Creating the record in the database
|
||||||
$created = $this->database->write($record);
|
$created = $this->database->write($record);
|
||||||
|
|
||||||
// Exit (success)
|
// Exit (success)
|
|
@ -0,0 +1,105 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace svoboda\svoboder\models\distribution;
|
||||||
|
|
||||||
|
// Files of the project
|
||||||
|
use svoboda\svoboder\models\core,
|
||||||
|
svoboda\svoboder\models\enumerations\entity;
|
||||||
|
|
||||||
|
// 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 telegram;
|
||||||
|
|
||||||
|
// Built-in libraries
|
||||||
|
use Exception as exception,
|
||||||
|
RuntimeException as exception_runtime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message
|
||||||
|
*
|
||||||
|
* @package svoboda\svoboder\models\distributions
|
||||||
|
*
|
||||||
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||||
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
|
*/
|
||||||
|
final class message extends core
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* File
|
||||||
|
*
|
||||||
|
* @var string $database Path to the database file
|
||||||
|
*/
|
||||||
|
protected string $file = DATABASES . DIRECTORY_SEPARATOR . 'distributions' . DIRECTORY_SEPARATOR . 'messages.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::ascii)
|
||||||
|
->columns(
|
||||||
|
new column('identifier', type::integer_unsigned),
|
||||||
|
new column('distribution', type::integer_unsigned),
|
||||||
|
new column('account', type::integer_unsigned),
|
||||||
|
new column('text', type::string, ['length' => 512]),
|
||||||
|
new column('updated', type::integer_unsigned),
|
||||||
|
new column('created', type::integer_unsigned)
|
||||||
|
)
|
||||||
|
->connect($this->file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create
|
||||||
|
*
|
||||||
|
* Creates the message record in the database
|
||||||
|
*
|
||||||
|
* @param int $distribution Identifier of the distribution
|
||||||
|
* @param int $account Identifier of the account
|
||||||
|
* @param string $text Text
|
||||||
|
*
|
||||||
|
* @return int|false The record identifier, if created
|
||||||
|
*/
|
||||||
|
public function create(int $distribution, int $account, string $text): int|false
|
||||||
|
{
|
||||||
|
// Initializing the identifier
|
||||||
|
$identifier = $this->database->count() + 1;
|
||||||
|
|
||||||
|
// Initializing the record
|
||||||
|
$record = $this->database->record(
|
||||||
|
$identifier,
|
||||||
|
$distribution,
|
||||||
|
$account,
|
||||||
|
$text,
|
||||||
|
svoboda::timestamp(),
|
||||||
|
svoboda::timestamp()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Creating the record in the database
|
||||||
|
$created = $this->database->write($record);
|
||||||
|
|
||||||
|
// Exit (success)
|
||||||
|
return $created ? $identifier : false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,8 +14,9 @@ namespace svoboda\svoboder\models\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 entity
|
enum entity: int
|
||||||
{
|
{
|
||||||
case account;
|
case system = 0;
|
||||||
case distribution;
|
case account = 1;
|
||||||
|
case distribution = 2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace svoboda\svoboder\models\enumerations\member;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Status
|
||||||
|
*
|
||||||
|
* Member status
|
||||||
|
*
|
||||||
|
* @package svoboda\svoboder\models\enumerations\member
|
||||||
|
*
|
||||||
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||||
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
|
*/
|
||||||
|
enum status: int
|
||||||
|
{
|
||||||
|
case unknown = 0;
|
||||||
|
case planned = 1;
|
||||||
|
case joined = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emoji
|
||||||
|
*
|
||||||
|
* Initialize emoji of the status
|
||||||
|
*
|
||||||
|
* @return string Emoji of the status
|
||||||
|
*/
|
||||||
|
public function emoji(): string
|
||||||
|
{
|
||||||
|
// Exit (success)
|
||||||
|
return match ($this) {
|
||||||
|
status::unknown => '👽',
|
||||||
|
status::planned => '📅',
|
||||||
|
status::joined => '🧳'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,113 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace svoboda\svoboder\models;
|
||||||
|
|
||||||
|
// Files of the project
|
||||||
|
use svoboda\svoboder\models\core,
|
||||||
|
svoboda\svoboder\models\enumerations\entity,
|
||||||
|
svoboda\svoboder\models\enumerations\member\status;
|
||||||
|
|
||||||
|
// 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 telegram;
|
||||||
|
|
||||||
|
// Built-in libraries
|
||||||
|
use Exception as exception,
|
||||||
|
RuntimeException as exception_runtime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Member
|
||||||
|
*
|
||||||
|
* @package svoboda\svoboder\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 member extends core
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* File
|
||||||
|
*
|
||||||
|
* @var string $database Path to the database file
|
||||||
|
*/
|
||||||
|
protected string $file = DATABASES . DIRECTORY_SEPARATOR . 'members.baza';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database
|
||||||
|
*
|
||||||
|
* Identifier: The record identifier
|
||||||
|
* Distribution: The distribution
|
||||||
|
* Account: The account
|
||||||
|
* Status: 1 - planned; 2 - joined
|
||||||
|
* Updated: Timestamp of the last the record update
|
||||||
|
* Created: Timestamp of the record creating
|
||||||
|
*
|
||||||
|
* @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::ascii)
|
||||||
|
->columns(
|
||||||
|
new column('identifier', type::integer_unsigned),
|
||||||
|
new column('distribution', type::integer_unsigned),
|
||||||
|
new column('account', type::integer_unsigned),
|
||||||
|
new column('status', type::char),
|
||||||
|
new column('updated', type::integer_unsigned),
|
||||||
|
new column('created', type::integer_unsigned)
|
||||||
|
)
|
||||||
|
->connect($this->file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create
|
||||||
|
*
|
||||||
|
* Creates the member record in the database
|
||||||
|
*
|
||||||
|
* @param int $distribution Identifier of the distribution
|
||||||
|
* @param int $account Identifier of the account
|
||||||
|
* @param status $status The distribution memberhip status
|
||||||
|
*
|
||||||
|
* @return int|false The record identifier, if created
|
||||||
|
*/
|
||||||
|
public function create(int $distribution, int $account, status $status = status::unknown): int|false
|
||||||
|
{var_dump($this->database->count());
|
||||||
|
// Initializing the identifier
|
||||||
|
$identifier = $this->database->count() + 1;
|
||||||
|
|
||||||
|
// Initializing the record
|
||||||
|
$record = $this->database->record(
|
||||||
|
$identifier,
|
||||||
|
$distribution,
|
||||||
|
$account,
|
||||||
|
$status->value,
|
||||||
|
svoboda::timestamp(),
|
||||||
|
svoboda::timestamp()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Creating the record in the database
|
||||||
|
$created = $this->database->write($record);
|
||||||
|
|
||||||
|
// Exit (success)
|
||||||
|
return $created ? $identifier : false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,160 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace svoboda\svoboder\models\telegram;
|
||||||
|
|
||||||
|
// Files of the project
|
||||||
|
use svoboda\svoboder\models\core,
|
||||||
|
svoboda\svoboder\models\account as model,
|
||||||
|
svoboda\svoboder\models\enumerations\language;
|
||||||
|
|
||||||
|
// Framework for Telegram
|
||||||
|
use Zanzara\Context as context,
|
||||||
|
Zanzara\Telegram\Type\Message as message;
|
||||||
|
|
||||||
|
// Baza database
|
||||||
|
use mirzaev\baza\record;
|
||||||
|
|
||||||
|
// Built-in libraries
|
||||||
|
use Error as error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Telegram account
|
||||||
|
*
|
||||||
|
* @package svoboda\svoboder\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 account extends core
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Localizations
|
||||||
|
*
|
||||||
|
* Sends a message with the localizations menu
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function localizations(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['account_localization_title'] . '*';
|
||||||
|
|
||||||
|
// Initializing the account model
|
||||||
|
$model_account = new model;
|
||||||
|
|
||||||
|
// Initializing existed account localizations
|
||||||
|
$existed = $model_account->localization->database->read(
|
||||||
|
filter: fn(record $localization) => $localization->account === $account->identifier,
|
||||||
|
amount: ACCOUNT_LOCALIZATION_ACCOUNT_LOCALIZATIONS_AMOUNT
|
||||||
|
);
|
||||||
|
|
||||||
|
// Initializing localizations amount
|
||||||
|
$amount = '*' . $localization['account_localization_amount'] . ':* ' . count($existed);
|
||||||
|
|
||||||
|
// Declaring the buffer of generated keyboard with languages
|
||||||
|
$keyboard = [];
|
||||||
|
|
||||||
|
// Initializing the iterator of rows
|
||||||
|
$row = 0;
|
||||||
|
|
||||||
|
foreach ($existed as $record) {
|
||||||
|
// Iterating over existed account localizations
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Initializing the localization language
|
||||||
|
$language = language::{$record->language};
|
||||||
|
|
||||||
|
// Initializing the row
|
||||||
|
$keyboard[$row] ??= [];
|
||||||
|
|
||||||
|
// Writing the language choose button into the buffer of generated keyboard with languages
|
||||||
|
$keyboard[$row][] = [
|
||||||
|
'text' => ($language->flag() ? $language->flag() . ' ' : '') . $language->label($language),
|
||||||
|
'callback_data' => "account_localization_update_$language->name"
|
||||||
|
];
|
||||||
|
|
||||||
|
// When reaching 4 buttons in a row, move to the next row
|
||||||
|
if (count($keyboard[$row]) === 4) ++$row;
|
||||||
|
} catch (error $error) {
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_create_failted_to_initialize_language'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($existed) !== count(language::cases())) {
|
||||||
|
// Not all languages in the registry have localizations created (expected)
|
||||||
|
|
||||||
|
// Writing the button for helping lozalizing
|
||||||
|
$keyboard[$row === 0 && empty($keyboard[0]) ? 0 : ++$row] = [
|
||||||
|
[
|
||||||
|
'text' => '✏️ ' . $localization['account_localization_create'],
|
||||||
|
'callback_data' => 'account_localization_create_start'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage(
|
||||||
|
<<<TXT
|
||||||
|
$title
|
||||||
|
|
||||||
|
$amount
|
||||||
|
TXT,
|
||||||
|
[
|
||||||
|
'reply_markup' => [
|
||||||
|
'inline_keyboard' => $keyboard,
|
||||||
|
'disable_notification' => true,
|
||||||
|
'remove_keyboard' => true
|
||||||
|
],
|
||||||
|
]
|
||||||
|
)->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
});
|
||||||
|
} 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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,228 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace svoboda\svoboder\models\telegram\buttons\account\localization;
|
||||||
|
|
||||||
|
// Files of the project
|
||||||
|
use svoboda\svoboder\models\core,
|
||||||
|
svoboda\svoboder\models\enumerations\language,
|
||||||
|
svoboda\svoboder\models\account,
|
||||||
|
svoboda\svoboder\models\telegram\selections,
|
||||||
|
svoboda\svoboder\models\telegram\processes\account\localization\create as process_account_localization_create;
|
||||||
|
|
||||||
|
// Framework for Telegram
|
||||||
|
use Zanzara\Context as context,
|
||||||
|
Zanzara\Telegram\Type\Message as message;
|
||||||
|
|
||||||
|
// Baza database
|
||||||
|
use mirzaev\baza\record;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Telegram account localization create buttons
|
||||||
|
*
|
||||||
|
* @package svoboda\svoboder\models\telegram\buttons\account\localization
|
||||||
|
*
|
||||||
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||||
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
|
*/
|
||||||
|
final class create extends core
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Language
|
||||||
|
*
|
||||||
|
* Send the language selection menu
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function language(context $context)
|
||||||
|
{
|
||||||
|
// Initializing the account
|
||||||
|
$account = $context->get('account');
|
||||||
|
|
||||||
|
if ($account instanceof record) {
|
||||||
|
// Initialized the account
|
||||||
|
|
||||||
|
// Initializing language
|
||||||
|
$language = $context->get('language');
|
||||||
|
|
||||||
|
if ($language) {
|
||||||
|
// Initialized language
|
||||||
|
|
||||||
|
// Initializing localization
|
||||||
|
$localization = $context->get('localization');
|
||||||
|
|
||||||
|
if ($localization) {
|
||||||
|
// Initialized localization
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(process_account_localization_create::PROCESS)
|
||||||
|
->then(function (?array $process) use ($context, $account, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($process) {
|
||||||
|
// Found started account localization create process
|
||||||
|
|
||||||
|
// Initializing the account model
|
||||||
|
$model_account = new account;
|
||||||
|
|
||||||
|
// Initializing the account localizations
|
||||||
|
$existed = $model_account->localization->database->read(
|
||||||
|
filter: fn(record $localization) => $localization->account === $account->identifier,
|
||||||
|
amount: ACCOUNT_LOCALIZATION_CREATE_ACCOUNT_LOCALIZATIONS_AMOUNT
|
||||||
|
);
|
||||||
|
|
||||||
|
// Declaring the buffer of languages to exclude
|
||||||
|
$exclude = [];
|
||||||
|
|
||||||
|
// Initializing languages to exclude
|
||||||
|
foreach ($existed as $record) $exclude[] = $record->language;
|
||||||
|
|
||||||
|
if (count($exclude) !== count(language::cases())) {
|
||||||
|
// Not all languages in the registry have localizations created (expected)
|
||||||
|
|
||||||
|
// Sending the language selection
|
||||||
|
selections::language(
|
||||||
|
context: $context,
|
||||||
|
prefix: 'account_localization_create_select_language_',
|
||||||
|
title: '🌏 *' . $localization['account_localization_create_select_language_title'] . '*',
|
||||||
|
description: '🌏 *' . $localization['account_localization_create_select_language_description'] . '*',
|
||||||
|
exclude: $exclude
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// All languages in the registry have localizations created (expected)
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_create_every_language_created'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not found started account localization create process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_create_not_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} 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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name
|
||||||
|
*
|
||||||
|
* Request to enter name
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function name(context $context)
|
||||||
|
{
|
||||||
|
// Initializing the account
|
||||||
|
$account = $context->get('account');
|
||||||
|
|
||||||
|
if ($account instanceof record) {
|
||||||
|
// Initialized the account
|
||||||
|
|
||||||
|
// Initializing localization
|
||||||
|
$localization = $context->get('localization');
|
||||||
|
|
||||||
|
if ($localization) {
|
||||||
|
// Initialized localization
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(process_account_localization_create::PROCESS)
|
||||||
|
->then(function (?array $process) use ($context, $account, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($process) {
|
||||||
|
// Found started account localization create process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('📄 *' . $localization['account_localization_create_name_request'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Writing into the account localization create buffer
|
||||||
|
$context->nextStep([process_account_localization_create::class, 'name']);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not found started account localization create process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_create_not_started'] . '*');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} 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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,102 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace svoboda\svoboder\models\telegram\buttons\account\localization;
|
||||||
|
|
||||||
|
// Files of the project
|
||||||
|
use svoboda\svoboder\models\core,
|
||||||
|
svoboda\svoboder\models\enumerations\language,
|
||||||
|
svoboda\svoboder\models\account,
|
||||||
|
svoboda\svoboder\models\telegram\selections,
|
||||||
|
svoboda\svoboder\models\telegram\processes\account\localization\update as process_account_localization_update;
|
||||||
|
|
||||||
|
// Framework for Telegram
|
||||||
|
use Zanzara\Context as context,
|
||||||
|
Zanzara\Telegram\Type\Message as message;
|
||||||
|
|
||||||
|
// Baza database
|
||||||
|
use mirzaev\baza\record;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Telegram account localization update buttons
|
||||||
|
*
|
||||||
|
* @package svoboda\svoboder\models\telegram\buttons\account\localization
|
||||||
|
*
|
||||||
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||||
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
|
*/
|
||||||
|
final class update extends core
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Name
|
||||||
|
*
|
||||||
|
* Request to enter name
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function name(context $context)
|
||||||
|
{
|
||||||
|
// Initializing the account
|
||||||
|
$account = $context->get('account');
|
||||||
|
|
||||||
|
if ($account instanceof record) {
|
||||||
|
// Initialized the account
|
||||||
|
|
||||||
|
// Initializing localization
|
||||||
|
$localization = $context->get('localization');
|
||||||
|
|
||||||
|
if ($localization) {
|
||||||
|
// Initialized localization
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(process_account_localization_update::PROCESS)
|
||||||
|
->then(function (?array $process) use ($context, $account, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($process) {
|
||||||
|
// Found started account localization update process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('📄 *' . $localization['account_localization_update_name_request'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Writing into the account localization update buffer
|
||||||
|
$context->nextStep([process_account_localization_update::class, 'name']);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not found started account localization update process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_update_not_started'] . '*');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} 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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,9 +8,8 @@ namespace svoboda\svoboder\models\telegram\buttons\distribution;
|
||||||
use svoboda\svoboder\models\core,
|
use svoboda\svoboder\models\core,
|
||||||
svoboda\svoboder\models\account,
|
svoboda\svoboder\models\account,
|
||||||
svoboda\svoboder\models\distribution,
|
svoboda\svoboder\models\distribution,
|
||||||
svoboda\svoboder\models\telegram\selections,
|
svoboda\svoboder\models\telegram\processes\language\select as process_language_select,
|
||||||
svoboda\svoboder\models\telegram\processes\distribution\registration as process_distribution_registration,
|
svoboda\svoboder\models\telegram\processes\distribution\declaration as process_distribution_declaration,
|
||||||
svoboda\svoboder\models\localization\distribution as distribution_localization,
|
|
||||||
svoboda\svoboder\models\enumerations\language;
|
svoboda\svoboder\models\enumerations\language;
|
||||||
|
|
||||||
// Framework for Telegram
|
// Framework for Telegram
|
||||||
|
@ -21,14 +20,14 @@ use Zanzara\Context as context,
|
||||||
use mirzaev\baza\record;
|
use mirzaev\baza\record;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Telegram distribution registration buttons
|
* Telegram distribution declaration buttons
|
||||||
*
|
*
|
||||||
* @package svoboda\svoboder\models\telegram\buttons\distribution
|
* @package svoboda\svoboder\models\telegram\buttons\distribution
|
||||||
*
|
*
|
||||||
* @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 registration extends core
|
final class declaration extends core
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Language
|
* Language
|
||||||
|
@ -60,25 +59,25 @@ final class registration extends core
|
||||||
// Initialized localization
|
// Initialized localization
|
||||||
|
|
||||||
// Reading from the telegram user buffer
|
// Reading from the telegram user buffer
|
||||||
$context->getUserDataItem('distribution_registration')
|
$context->getUserDataItem(process_distribution_declaration::PROCESS)
|
||||||
->then(function ($distribution) use ($context, $account, $localization) {
|
->then(function ($distribution) use ($context, $account, $localization) {
|
||||||
// Readed from the telegram user buffer
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
if ($distribution) {
|
if ($distribution) {
|
||||||
// Found started registration process
|
// Found started declaration process
|
||||||
|
|
||||||
// Sending the language selection
|
// Sending the language selection
|
||||||
selections::language(
|
process_language_select::menu(
|
||||||
context: $context,
|
context: $context,
|
||||||
prefix: 'distribution_registration_select_language_',
|
prefix: 'distribution_declaration_select_language_',
|
||||||
title: '🌏 *' . $localization['distribution_registration_select_language_title'] . '*',
|
title: '🌏 *' . $localization['distribution_declaration_select_language_title'] . '*',
|
||||||
description: '🌏 *' . $localization['distribution_registration_select_language_description'] . '*'
|
description: '🌏 *' . $localization['distribution_declaration_select_language_description'] . '*'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// Not found started registration process
|
// Not found started declaration process
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
|
$context->sendMessage('⚠️ *' . $localization['distribution_declaration_not_started'] . '*');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -137,26 +136,26 @@ final class registration extends core
|
||||||
// Initialized localization
|
// Initialized localization
|
||||||
|
|
||||||
// Reading from the telegram user buffer
|
// Reading from the telegram user buffer
|
||||||
$context->getUserDataItem('distribution_registration')
|
$context->getUserDataItem(process_distribution_declaration::PROCESS)
|
||||||
->then(function ($distribution) use ($context, $account, $localization) {
|
->then(function ($distribution) use ($context, $account, $localization) {
|
||||||
// Readed from the telegram user buffer
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
if ($distribution) {
|
if ($distribution) {
|
||||||
// Found started registration process
|
// Found started declaration process
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('📄 *' . $localization['distribution_registration_name_request'] . '*')
|
$context->sendMessage('📄 *' . $localization['distribution_declaration_name_request'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
// Writing into the distribution registration buffer
|
// Writing into the distribution declaration buffer
|
||||||
$context->nextStep([process_distribution_registration::class, 'name']);
|
$context->nextStep([process_distribution_declaration::class, 'name']);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Not found started registration process
|
// Not found started declaration process
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
|
$context->sendMessage('⚠️ *' . $localization['distribution_declaration_not_started'] . '*');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -205,18 +204,18 @@ final class registration extends core
|
||||||
// Initialized localization
|
// Initialized localization
|
||||||
|
|
||||||
// Reading from the telegram user buffer
|
// Reading from the telegram user buffer
|
||||||
$context->getUserDataItem('distribution_registration')
|
$context->getUserDataItem(process_distribution_declaration::PROCESS)
|
||||||
->then(function ($distribution) use ($context, $account, $localization) {
|
->then(function ($distribution) use ($context, $account, $localization) {
|
||||||
// Readed from the telegram user buffer
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
if ($distribution) {
|
if ($distribution) {
|
||||||
// Found started registration process
|
// Found started declaration process
|
||||||
|
|
||||||
// Initializing the message title
|
// Initializing the message title
|
||||||
$title = '🗺 *' . $localization['distribution_registration_location_send_title'] . '*';
|
$title = '🗺 *' . $localization['distribution_declaration_location_send_title'] . '*';
|
||||||
|
|
||||||
// Initializing the message description
|
// Initializing the message description
|
||||||
$description = $localization['distribution_registration_location_send_description'];
|
$description = $localization['distribution_declaration_location_send_description'];
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage(
|
$context->sendMessage(
|
||||||
|
@ -230,7 +229,7 @@ final class registration extends core
|
||||||
'keyboard' => [
|
'keyboard' => [
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => '🗺 ' . $localization['distribution_registration_button_location_send'],
|
'text' => '🗺 ' . $localization['distribution_declaration_button_location_send'],
|
||||||
'request_location' => true
|
'request_location' => true
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
@ -242,14 +241,14 @@ final class registration extends core
|
||||||
)->then(function (message $message) use ($context) {
|
)->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
// Writing into the distribution registration buffer
|
// Writing into the distribution declaration buffer
|
||||||
$context->nextStep([process_distribution_registration::class, 'location']);
|
$context->nextStep([process_distribution_declaration::class, 'location']);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Not found started registration process
|
// Not found started declaration process
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
|
$context->sendMessage('⚠️ *' . $localization['distribution_declaration_not_started'] . '*');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,276 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace svoboda\svoboder\models\telegram\buttons\distribution;
|
||||||
|
|
||||||
|
// Files of the project
|
||||||
|
use svoboda\svoboder\models\core,
|
||||||
|
svoboda\svoboder\models\telegram\processes\distribution\select as process_distribution_select;
|
||||||
|
|
||||||
|
// Framework for Telegram
|
||||||
|
use Zanzara\Context as context,
|
||||||
|
Zanzara\Telegram\Type\Message as message;
|
||||||
|
|
||||||
|
// Baza database
|
||||||
|
use mirzaev\baza\record;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Telegram distribution select buttons
|
||||||
|
*
|
||||||
|
* @package svoboda\svoboder\models\telegram\buttons\distribution
|
||||||
|
*
|
||||||
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||||
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
|
*/
|
||||||
|
final class select extends core
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Name
|
||||||
|
*
|
||||||
|
* Request to enter name
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function name(context $context)
|
||||||
|
{
|
||||||
|
// Initializing the account
|
||||||
|
$account = $context->get('account');
|
||||||
|
|
||||||
|
if ($account instanceof record) {
|
||||||
|
// Initialized the account
|
||||||
|
|
||||||
|
// Initializing localization
|
||||||
|
$localization = $context->get('localization');
|
||||||
|
|
||||||
|
if ($localization) {
|
||||||
|
// Initialized localization
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(process_distribution_select::PROCESS)
|
||||||
|
->then(function ($select) use ($context, $account, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($select) {
|
||||||
|
// Found started select process
|
||||||
|
|
||||||
|
// Initializing title for the message
|
||||||
|
$title = '📄 *' . $localization[process_distribution_select::PROCESS . '_name_request_title'] . '*';
|
||||||
|
|
||||||
|
// Initializing description for the message
|
||||||
|
$description = $localization[process_distribution_select::PROCESS . '_name_request_description'];
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage(<<<TXT
|
||||||
|
$title
|
||||||
|
|
||||||
|
$description
|
||||||
|
TXT)
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Writing into the distribution select buffer
|
||||||
|
$context->nextStep([process_distribution_select::class, 'name']);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not found started select process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization[process_distribution_select::PROCESS . '_not_started'] . '*');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not initialized localization
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
||||||
|
->then(function ($message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not initialized the account
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
||||||
|
->then(function ($message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Location
|
||||||
|
*
|
||||||
|
* Request to send location
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function location(context $context)
|
||||||
|
{
|
||||||
|
// Initializing the account
|
||||||
|
$account = $context->get('account');
|
||||||
|
|
||||||
|
if ($account instanceof record) {
|
||||||
|
// Initialized the account
|
||||||
|
|
||||||
|
// Initializing localization
|
||||||
|
$localization = $context->get('localization');
|
||||||
|
|
||||||
|
if ($localization) {
|
||||||
|
// Initialized localization
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(process_distribution_select::PROCESS)
|
||||||
|
->then(function ($select) use ($context, $account, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($select) {
|
||||||
|
// Found started select process
|
||||||
|
|
||||||
|
// Initializing the message title
|
||||||
|
$title = '🗺 *' . $localization[process_distribution_select::PROCESS . '_location_send_title'] . '*';
|
||||||
|
|
||||||
|
// Initializing the message description
|
||||||
|
$description = $localization[process_distribution_select::PROCESS . '_location_send_description'];
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage(
|
||||||
|
<<<TXT
|
||||||
|
$title
|
||||||
|
|
||||||
|
$description
|
||||||
|
TXT,
|
||||||
|
[
|
||||||
|
'reply_markup' => [
|
||||||
|
'keyboard' => [
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'text' => '🗺 ' . $localization[process_distribution_select::PROCESS . '_button_location_send'],
|
||||||
|
'request_location' => true
|
||||||
|
]
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'disable_notification' => true
|
||||||
|
]
|
||||||
|
]
|
||||||
|
)->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Writing into the distribution select buffer
|
||||||
|
$context->nextStep([process_distribution_select::class, 'location']);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not found started select process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization[process_distribution_select::PROCESS . '_not_started'] . '*');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not initialized localization
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
||||||
|
->then(function ($message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not initialized the account
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
||||||
|
->then(function ($message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Distance
|
||||||
|
*
|
||||||
|
* Request to send distance
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function distance(context $context)
|
||||||
|
{
|
||||||
|
// Initializing the account
|
||||||
|
$account = $context->get('account');
|
||||||
|
|
||||||
|
if ($account instanceof record) {
|
||||||
|
// Initialized the account
|
||||||
|
|
||||||
|
// Initializing localization
|
||||||
|
$localization = $context->get('localization');
|
||||||
|
|
||||||
|
if ($localization) {
|
||||||
|
// Initialized localization
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(process_distribution_select::PROCESS)
|
||||||
|
->then(function ($select) use ($context, $account, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($select) {
|
||||||
|
// Found started select process
|
||||||
|
|
||||||
|
// Initializing the message title
|
||||||
|
$title = '🔭 *' . $localization[process_distribution_select::PROCESS . '_distance_request_title'] . '* \(' . $localization[process_distribution_select::PROCESS . '_km'] . '\)';
|
||||||
|
|
||||||
|
// Initializing the message description
|
||||||
|
$description = $localization[process_distribution_select::PROCESS . '_distance_request_description'];
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage(
|
||||||
|
<<<TXT
|
||||||
|
$title
|
||||||
|
|
||||||
|
$description
|
||||||
|
TXT
|
||||||
|
)->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Writing into the distribution select buffer
|
||||||
|
$context->nextStep([process_distribution_select::class, 'distance']);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not found started select process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization[process_distribution_select::PROCESS . '_not_started'] . '*');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not initialized localization
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
||||||
|
->then(function ($message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not initialized the account
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
||||||
|
->then(function ($message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,312 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace svoboda\svoboder\models\telegram\buttons\member;
|
||||||
|
|
||||||
|
// Files of the project
|
||||||
|
use svoboda\svoboder\models\core,
|
||||||
|
svoboda\svoboder\models\account,
|
||||||
|
svoboda\svoboder\models\distribution,
|
||||||
|
svoboda\svoboder\models\telegram\processes\distribution\select as process_distribution_select,
|
||||||
|
svoboda\svoboder\models\telegram\processes\member\search as process_member_search,
|
||||||
|
svoboda\svoboder\models\enumerations\member\status,
|
||||||
|
svoboda\svoboder\models\enumerations\language;
|
||||||
|
|
||||||
|
// Framework for Telegram
|
||||||
|
use Zanzara\Context as context,
|
||||||
|
Zanzara\Telegram\Type\Message as message,
|
||||||
|
Zanzara\Telegram\Type\Keyboard\InlineKeyboardMarkup as keyboard_inline,
|
||||||
|
Zanzara\Telegram\Type\Keyboard\InlineKeyboardButton as keyboard_inline_button;
|
||||||
|
|
||||||
|
// Baza database
|
||||||
|
use mirzaev\baza\record;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Telegram member search buttons
|
||||||
|
*
|
||||||
|
* @package svoboda\svoboder\models\telegram\buttons\member
|
||||||
|
*
|
||||||
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||||
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
|
*/
|
||||||
|
final class search extends core
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Name
|
||||||
|
*
|
||||||
|
* Request to enter name
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function name(context $context)
|
||||||
|
{
|
||||||
|
// Initializing the account
|
||||||
|
$account = $context->get('account');
|
||||||
|
|
||||||
|
if ($account instanceof record) {
|
||||||
|
// Initialized the account
|
||||||
|
|
||||||
|
// Initializing localization
|
||||||
|
$localization = $context->get('localization');
|
||||||
|
|
||||||
|
if ($localization) {
|
||||||
|
// Initialized localization
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(process_member_search::PROCESS)
|
||||||
|
->then(function ($search) use ($context, $account, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($search) {
|
||||||
|
// Found started search process
|
||||||
|
|
||||||
|
// Initializing title for the message
|
||||||
|
$title = '📄 *' . $localization[process_member_search::PROCESS . '_name_request_title'] . '*';
|
||||||
|
|
||||||
|
// Initializing description for the message
|
||||||
|
$description = $localization[process_member_search::PROCESS . '_name_request_description'];
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage(<<<TXT
|
||||||
|
$title
|
||||||
|
|
||||||
|
$description
|
||||||
|
TXT)
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Writing into the member search buffer
|
||||||
|
$context->nextStep([process_member_search::class, 'name']);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not found started search process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization[process_member_search::PROCESS . '_not_started'] . '*');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not initialized localization
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
||||||
|
->then(function ($message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not initialized the account
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
||||||
|
->then(function ($message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Distribution
|
||||||
|
*
|
||||||
|
* Request to choose distribution
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function distribution(context $context)
|
||||||
|
{
|
||||||
|
// Initializing the account
|
||||||
|
$account = $context->get('account');
|
||||||
|
|
||||||
|
if ($account instanceof record) {
|
||||||
|
// Initialized the account
|
||||||
|
|
||||||
|
// Initializing localization
|
||||||
|
$localization = $context->get('localization');
|
||||||
|
|
||||||
|
if ($localization) {
|
||||||
|
// Initialized localization
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(process_member_search::PROCESS)
|
||||||
|
->then(function ($search) use ($context, $account, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($search) {
|
||||||
|
// Found started search process
|
||||||
|
|
||||||
|
// Starting the distribution selection process
|
||||||
|
process_distribution_select::start(
|
||||||
|
context: $context,
|
||||||
|
select: function (context $context, array $distribution) use ($search) {
|
||||||
|
|
||||||
|
if (!empty($distribution['distribution']) && !empty($distribution['localization'])) {
|
||||||
|
// Initialized the distribution
|
||||||
|
|
||||||
|
// Writing the distribution into the process buffer
|
||||||
|
$search['distribution'] = $distribution;
|
||||||
|
|
||||||
|
// Writing to the telegram user buffer
|
||||||
|
$context->setUserDataItem(process_member_search::PROCESS, $search)
|
||||||
|
->then(function () use ($context) {
|
||||||
|
// Writed into the telegram user buffer
|
||||||
|
|
||||||
|
// Sending the list of found distributions and menu
|
||||||
|
process_member_search::menu($context);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not initialized the distribution
|
||||||
|
}
|
||||||
|
},
|
||||||
|
delete: function (context $context) use ($search) {
|
||||||
|
// Deleting the distribution from the process buffer
|
||||||
|
$search['distribution'] = [
|
||||||
|
'distribution' => null,
|
||||||
|
'localization' => null
|
||||||
|
];
|
||||||
|
|
||||||
|
// Writing to the telegram user buffer
|
||||||
|
$context->setUserDataItem(process_member_search::PROCESS, $search)
|
||||||
|
->then(function () use ($context) {
|
||||||
|
// Writed into the telegram user buffer
|
||||||
|
|
||||||
|
// Sending the list of found distributions and menu
|
||||||
|
process_member_search::menu($context);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
cancel: function (context $context) {
|
||||||
|
// Sending the list of found distributions and menu
|
||||||
|
process_member_search::menu($context);
|
||||||
|
},
|
||||||
|
description: $localization[process_member_search::PROCESS . '_distribution_selection_description']
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Not found started search process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization[process_member_search::PROCESS . '_not_started'] . '*');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not initialized localization
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
||||||
|
->then(function ($message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not initialized the account
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
||||||
|
->then(function ($message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Status
|
||||||
|
*
|
||||||
|
* Request to choose status
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function status(context $context)
|
||||||
|
{
|
||||||
|
// Initializing the account
|
||||||
|
$account = $context->get('account');
|
||||||
|
|
||||||
|
if ($account instanceof record) {
|
||||||
|
// Initialized the account
|
||||||
|
|
||||||
|
// Initializing localization
|
||||||
|
$localization = $context->get('localization');
|
||||||
|
|
||||||
|
if ($localization) {
|
||||||
|
// Initialized localization
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(process_member_search::PROCESS)
|
||||||
|
->then(function ($search) use ($context, $account, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($search) {
|
||||||
|
// Found started search process
|
||||||
|
|
||||||
|
// Declaring the keyboard buffer
|
||||||
|
$keyboard = [[]];
|
||||||
|
|
||||||
|
// Initializing the amount of buttons in one row
|
||||||
|
$amount = MEMBERS_SEARCH_STATUS_ROW_AMOUNT ?? 8;
|
||||||
|
|
||||||
|
// Initializing the rows iterator
|
||||||
|
$row = 0;
|
||||||
|
|
||||||
|
foreach (status::cases() as $status) {
|
||||||
|
// Iterating over statuses
|
||||||
|
|
||||||
|
// Moving to the next row
|
||||||
|
if (count($keyboard[$row]) >= $amount) ++$row;
|
||||||
|
|
||||||
|
// Initializing the row
|
||||||
|
$keyboard[$row] ??= [];
|
||||||
|
|
||||||
|
// Generating the button and writing into the keyboard buffer
|
||||||
|
$keyboard[$row][] = [
|
||||||
|
'text' => $status->emoji() . ' ' . $localization[process_member_search::PROCESS . "_button_status_$status->value"],
|
||||||
|
'callback_data' => process_member_search::PROCESS . "_status_$status->name"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage(
|
||||||
|
'👤 *' . $localization[process_member_search::PROCESS . '_status_select_title'] . '*',
|
||||||
|
[
|
||||||
|
'reply_markup' => [
|
||||||
|
'inline_keyboard' => $keyboard,
|
||||||
|
'disable_notification' => true
|
||||||
|
]
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Not found started search process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization[process_member_search::PROCESS . '_not_started'] . '*');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not initialized localization
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
||||||
|
->then(function ($message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not initialized the account
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
||||||
|
->then(function ($message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,8 @@ namespace svoboda\svoboder\models\telegram;
|
||||||
use svoboda\svoboder\models\core,
|
use svoboda\svoboder\models\core,
|
||||||
svoboda\svoboder\models\account,
|
svoboda\svoboder\models\account,
|
||||||
svoboda\svoboder\models\distribution,
|
svoboda\svoboder\models\distribution,
|
||||||
svoboda\svoboder\models\telegram\selections,
|
svoboda\svoboder\models\member,
|
||||||
|
svoboda\svoboder\models\telegram\processes\language\select as process_language_select,
|
||||||
svoboda\svoboder\models\enumerations\language;
|
svoboda\svoboder\models\enumerations\language;
|
||||||
|
|
||||||
// Framework for Telegram
|
// Framework for Telegram
|
||||||
|
@ -56,13 +57,46 @@ final class commands extends core
|
||||||
$title = '📋 *' . $localization['menu_title'] . '*';
|
$title = '📋 *' . $localization['menu_title'] . '*';
|
||||||
|
|
||||||
// Initializing accounts
|
// Initializing accounts
|
||||||
$accounts = '*' . $localization['menu_accounts'] . '* ' . ((new account)->database->count() ?? 0);
|
$accounts = '*' . $localization['menu_accounts'] . ':* ' . ((new account)->database->count() ?? 0);
|
||||||
|
|
||||||
|
// Initializing the member model
|
||||||
|
$model_member = new member;
|
||||||
|
|
||||||
|
// Searching for members records
|
||||||
|
$records = $model_member->database->read(
|
||||||
|
filter: function (record $member, array $records = []) {
|
||||||
|
if ($member->status === 2) {
|
||||||
|
// The account joined to the distribution
|
||||||
|
|
||||||
|
foreach ($records as $record) {
|
||||||
|
// Iterating over readed records
|
||||||
|
|
||||||
|
if ($record->identifier === $member->identifier) {
|
||||||
|
// Found a dublicate of the member
|
||||||
|
|
||||||
|
// Exit (success)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exit (success)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exit (success)
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
amount: MENU_MEMBERS_AMOUNT
|
||||||
|
) ?? [];
|
||||||
|
|
||||||
// Initializing members
|
// Initializing members
|
||||||
$members = '*' . $localization['menu_members'] . '* ' . 0;
|
$members = '*' . $localization['menu_members'] . ':* ' . count($records);
|
||||||
|
|
||||||
// Initializing distributions
|
// Initializing distributions
|
||||||
$distributions = '*' . $localization['menu_distributions'] . '* ' . ((new distribution)->database->count() ?? 0);
|
$distributions = '*' . $localization['menu_distributions'] . ':* ' . ((new distribution)->database->count() ?? 0);
|
||||||
|
|
||||||
|
// Initializing the data syncronization for the message
|
||||||
|
$syncronization = '⛓️💥 ' . $localization['menu_not_syncronized'];
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage(
|
$context->sendMessage(
|
||||||
|
@ -72,14 +106,16 @@ final class commands extends core
|
||||||
$accounts
|
$accounts
|
||||||
$members
|
$members
|
||||||
$distributions
|
$distributions
|
||||||
|
|
||||||
|
$syncronization
|
||||||
TXT,
|
TXT,
|
||||||
[
|
[
|
||||||
'reply_markup' => [
|
'reply_markup' => [
|
||||||
'inline_keyboard' => [
|
'inline_keyboard' => [
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => '📺 ' . $localization['menu_button_site'],
|
'text' => '🔥 ' . $localization['menu_button_projects'],
|
||||||
'url' => 'https://svoboda.works'
|
'callback_data' => 'projects'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => '🗺 ' . $localization['menu_button_map'],
|
'text' => '🗺 ' . $localization['menu_button_map'],
|
||||||
|
@ -87,34 +123,24 @@ final class commands extends core
|
||||||
'url' => 'https://telegram.map.svoboda.works'
|
'url' => 'https://telegram.map.svoboda.works'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
/* [
|
[
|
||||||
'text' => '🔥 ' . $localization['menu_button_blog'],
|
'text' => '📺 ' . $localization['menu_button_site'],
|
||||||
'url' => 'https://t.me/svoboder_bot'
|
'url' => 'https://svoboda.works'
|
||||||
] */
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
/* [
|
/* [
|
||||||
'text' => '🏗 ' . $localization['menu_button_projects'],
|
'text' => '🏗 ' . $localization['menu_button_projects'],
|
||||||
'callback_data' => 'prjects'
|
'callback_data' => 'prjects'
|
||||||
], */
|
], */
|
||||||
/* [
|
[
|
||||||
'text' => '🐣 ' . $localization['menu_button_members'],
|
'text' => '🐣 ' . $localization['menu_button_members'],
|
||||||
'callback_data' => 'message'
|
'callback_data' => 'members'
|
||||||
], */
|
],
|
||||||
[
|
[
|
||||||
'text' => '🏘 ' . $localization['menu_button_distributions'],
|
'text' => '🏘 ' . $localization['menu_button_distributions'],
|
||||||
'callback_data' => 'distributions'
|
'callback_data' => 'distributions'
|
||||||
]
|
]
|
||||||
],
|
|
||||||
[
|
|
||||||
/* [
|
|
||||||
'text' => '🤟 ' . $localization['menu_button_volunteering'],
|
|
||||||
'callback_data' => 'volunteering'
|
|
||||||
], */
|
|
||||||
[
|
|
||||||
'text' => '✉️ ' . $localization['menu_button_message'],
|
|
||||||
'callback_data' => 'message'
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'disable_notification' => true,
|
'disable_notification' => true,
|
||||||
|
@ -188,6 +214,98 @@ final class commands extends core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Members
|
||||||
|
*
|
||||||
|
* Responce for the command: "/members"
|
||||||
|
*
|
||||||
|
* Sends the members menu
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function members(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
|
||||||
|
|
||||||
|
// Initializing the message title
|
||||||
|
$title = '🐣 *' . $localization['members_title'] . '*';
|
||||||
|
|
||||||
|
// Initializing the message description
|
||||||
|
$description = $localization['members_description'];
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage(
|
||||||
|
<<<TXT
|
||||||
|
$title
|
||||||
|
|
||||||
|
$description
|
||||||
|
TXT,
|
||||||
|
[
|
||||||
|
'reply_markup' => [
|
||||||
|
'inline_keyboard' => [
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'text' => '🔎 ' . $localization['members_button_search'],
|
||||||
|
'callback_data' => 'member_search_start'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'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) {
|
||||||
|
// 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) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not initialized the account
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Distributions
|
* Distributions
|
||||||
*
|
*
|
||||||
|
@ -228,22 +346,19 @@ final class commands extends core
|
||||||
// Initializing the distribution model
|
// Initializing the distribution model
|
||||||
$model = new distribution;
|
$model = new distribution;
|
||||||
|
|
||||||
// Initializing the message "registered" row
|
// Initializing the message "declared" row
|
||||||
$registered = '*' . $localization['distributions_registered'] . ':* ' . $model->database->count();
|
$declared = '*' . $localization['distributions_declared'] . ':* ' . $model->database->count();
|
||||||
|
|
||||||
// Initializing the message "confirmed" row
|
// Initializing the message "confirmed" row
|
||||||
$confirmed = '*' . $localization['distributions_confirmed'] . ':* ' . count($model->database->read(
|
$recognized = '*' . $localization['distributions_recognized'] . ':* ' . 0;
|
||||||
filter: fn(record $record) => $record->confirmed,
|
|
||||||
amount: 1000
|
|
||||||
));
|
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage(
|
$context->sendMessage(
|
||||||
<<<TXT
|
<<<TXT
|
||||||
$title
|
$title
|
||||||
|
|
||||||
$registered
|
$declared
|
||||||
$confirmed
|
$recognized
|
||||||
|
|
||||||
$description
|
$description
|
||||||
TXT,
|
TXT,
|
||||||
|
@ -252,8 +367,8 @@ final class commands extends core
|
||||||
'inline_keyboard' => [
|
'inline_keyboard' => [
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => '📋 ' . $localization['distributions_button_register'],
|
'text' => '📋 ' . $localization['distributions_button_declare'],
|
||||||
'callback_data' => 'distribution_registration_start'
|
'callback_data' => 'distribution_declaration_start'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'text' => '🔎 ' . $localization['distributions_button_search'],
|
'text' => '🔎 ' . $localization['distributions_button_search'],
|
||||||
|
@ -298,6 +413,117 @@ final class commands extends core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 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'];
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
||||||
|
// Skipping system authorizations
|
||||||
|
if (str_starts_with($key, 'authorized_system_')) continue;
|
||||||
|
|
||||||
|
// 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");
|
||||||
|
|
||||||
|
// Initializing the data export for the message
|
||||||
|
$export = '📤 ' . $localization['account_export'];
|
||||||
|
|
||||||
|
// Initializing the data security for the message
|
||||||
|
$data = $localization['account_data'];
|
||||||
|
|
||||||
|
// Initializing the data security repository for the message
|
||||||
|
$security = '📁 [' . $localization['account_security_repository'] . '](https://git.svoboda.works/mirzaev/security) \([' . $localization['account_security_repository_mirror_github'] . '](https://github.com/mature-woman/security)\)';
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage(
|
||||||
|
<<<TXT
|
||||||
|
$title
|
||||||
|
|
||||||
|
$authorizations
|
||||||
|
|
||||||
|
$export
|
||||||
|
|
||||||
|
$data
|
||||||
|
|
||||||
|
$security
|
||||||
|
TXT,
|
||||||
|
[
|
||||||
|
'reply_markup' => [
|
||||||
|
'inline_keyboard' => [
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'text' => '🗺 ' . $localization['account_button_localizations'],
|
||||||
|
'callback_data' => 'account_localizations'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Language
|
* Language
|
||||||
*
|
*
|
||||||
|
@ -330,7 +556,7 @@ final class commands extends core
|
||||||
// Initialized localization
|
// Initialized localization
|
||||||
|
|
||||||
// Sending the language selection
|
// Sending the language selection
|
||||||
selections::language(
|
process_language_select::menu(
|
||||||
context: $context,
|
context: $context,
|
||||||
prefix: 'settings_language_',
|
prefix: 'settings_language_',
|
||||||
title: '🌏 *' . $localization['settings_select_language_title'] . '*',
|
title: '🌏 *' . $localization['settings_select_language_title'] . '*',
|
||||||
|
|
|
@ -8,7 +8,6 @@ namespace svoboda\svoboder\models\telegram;
|
||||||
use svoboda\svoboder\models\core,
|
use svoboda\svoboder\models\core,
|
||||||
svoboda\svoboder\models\account,
|
svoboda\svoboder\models\account,
|
||||||
svoboda\svoboder\models\distribution as model,
|
svoboda\svoboder\models\distribution as model,
|
||||||
svoboda\svoboder\models\localization\distribution as distribution_localization,
|
|
||||||
svoboda\svoboder\models\enumerations\language;
|
svoboda\svoboder\models\enumerations\language;
|
||||||
|
|
||||||
// Framework for Telegram
|
// Framework for Telegram
|
||||||
|
@ -26,4 +25,142 @@ use mirzaev\baza\record;
|
||||||
* @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 distribution extends core {}
|
final class distribution extends core
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Distributions
|
||||||
|
*
|
||||||
|
* Sends a message with a list of distributions to
|
||||||
|
* which the account is a creator, member, planned or volunteer
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function list(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['distributions_list_title'] . '*';
|
||||||
|
|
||||||
|
// Initializing the account model
|
||||||
|
$model_account = new account;
|
||||||
|
|
||||||
|
// Initializing accounts
|
||||||
|
$accounts = '*' . $localization['menu_accounts'] . ':* ' . ($model_account->database->count() ?? 0);
|
||||||
|
|
||||||
|
// Initializing members
|
||||||
|
$members = '*' . $localization['menu_members'] . ':* ' . 0;
|
||||||
|
|
||||||
|
// Initializing trusted members
|
||||||
|
$members_trusted = '*' . $localization['menu_members_trusted'] . ':* ' . 0;
|
||||||
|
|
||||||
|
// Initializing planners
|
||||||
|
$planners = '*' . $localization['menu_planners'] . ':* ' . 0;
|
||||||
|
|
||||||
|
// Initializing volunteers
|
||||||
|
$volunteers = '*' . $localization['menu_volunteers'] . ':* ' . 0;
|
||||||
|
|
||||||
|
// Initializing the distribution model
|
||||||
|
$model_distribution = new model;
|
||||||
|
|
||||||
|
// Initializing distributions
|
||||||
|
$distributions = '*' . $localization['menu_distributions'] . ':* ' . ($model_distribution->database->count() ?? 0);
|
||||||
|
|
||||||
|
// Initializing trusted distributions
|
||||||
|
$distributions_trusted = '*' . $localization['menu_distributions_trusted'] . ':* ' . 0;
|
||||||
|
|
||||||
|
// Initializing distributions messages
|
||||||
|
$distributions_messages = '*' . $localization['menu_distributions_messages'] . ':* ' . ($model_distribution->message->database->count() ?? 0);
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage(
|
||||||
|
<<<TXT
|
||||||
|
$title
|
||||||
|
|
||||||
|
$accounts
|
||||||
|
|
||||||
|
$members
|
||||||
|
$members_trusted
|
||||||
|
$planners
|
||||||
|
$volunteers
|
||||||
|
|
||||||
|
$distributions
|
||||||
|
$distributions_trusted
|
||||||
|
$distributions_messages
|
||||||
|
TXT,
|
||||||
|
[
|
||||||
|
'reply_markup' => [
|
||||||
|
'inline_keyboard' => [
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'text' => '🔥 ' . $localization['menu_button_projects'],
|
||||||
|
'callback_data' => 'projects'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'text' => '🗺 ' . $localization['menu_button_map'],
|
||||||
|
'web_app' => [
|
||||||
|
'url' => 'https://telegram.map.svoboda.works'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'text' => '📺 ' . $localization['menu_button_site'],
|
||||||
|
'url' => 'https://svoboda.works'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
/* [
|
||||||
|
'text' => '🏗 ' . $localization['menu_button_projects'],
|
||||||
|
'callback_data' => 'prjects'
|
||||||
|
], */
|
||||||
|
[
|
||||||
|
'text' => '🐣 ' . $localization['menu_button_members'],
|
||||||
|
'callback_data' => 'message'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'text' => '🏘 ' . $localization['menu_button_distributions'],
|
||||||
|
'callback_data' => 'distributions'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'disable_notification' => true,
|
||||||
|
'remove_keyboard' => true
|
||||||
|
],
|
||||||
|
]
|
||||||
|
)
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
});
|
||||||
|
} 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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -66,6 +66,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -120,6 +122,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -175,6 +179,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -185,6 +191,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize the localization file*')
|
$context->sendMessage('⚠️ *Failed to initialize the localization file*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -195,6 +203,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize language*')
|
$context->sendMessage('⚠️ *Failed to initialize language*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -205,6 +215,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -249,6 +261,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⛔ *' . $localization['not_authorized_system'] . '*')
|
$context->sendMessage('⛔ *' . $localization['not_authorized_system'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -261,6 +275,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -272,6 +288,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -316,6 +334,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⛔ *' . $localization['not_authorized_contact'] . '*')
|
$context->sendMessage('⛔ *' . $localization['not_authorized_contact'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -328,6 +348,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -339,6 +361,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -346,16 +370,16 @@ final class middlewares extends core
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request (middleware)
|
* Join (middleware)
|
||||||
*
|
*
|
||||||
* Check the account for access to request to the organization
|
* Check the account for access to join to distributions
|
||||||
*
|
*
|
||||||
* @param context $context
|
* @param context $context
|
||||||
* @param node $next
|
* @param node $next
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function request(context $context, node $next): void
|
public static function join(context $context, node $next): void
|
||||||
{
|
{
|
||||||
// Is the process stopped?
|
// Is the process stopped?
|
||||||
if ($context->get('stop')) return;
|
if ($context->get('stop')) return;
|
||||||
|
@ -366,46 +390,52 @@ final class middlewares extends core
|
||||||
if ($account instanceof record) {
|
if ($account instanceof record) {
|
||||||
// Initialized the account
|
// Initialized the account
|
||||||
|
|
||||||
if ($account->authorized_request) {
|
|
||||||
// Authorized the account to request to the organization
|
|
||||||
|
|
||||||
// Continuation of the process
|
|
||||||
$next($context);
|
|
||||||
} else {
|
|
||||||
// Not authorized the account to request to the organization
|
|
||||||
|
|
||||||
// Initializing localization
|
// Initializing localization
|
||||||
$localization = $context->get('localization');
|
$localization = $context->get('localization');
|
||||||
|
|
||||||
if ($localization) {
|
if ($localization) {
|
||||||
// Initialized localization
|
// Initialized localization
|
||||||
|
|
||||||
|
if ($account->authorized_joins) {
|
||||||
|
// Authorized the account to joint to distributions
|
||||||
|
|
||||||
|
// Continuation of the process
|
||||||
|
$next($context);
|
||||||
|
} else {
|
||||||
|
// Not authorized the account to joint to distributions
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⛔ *' . $localization['not_authorized_request'] . '*')
|
$context->sendMessage('⛔ *' . $localization['not_authorized_joins'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Stopping the process
|
// Stopping the process
|
||||||
$context->set('stop', true);
|
$context->set('stop', true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not initialized localization
|
// Not initialized localization
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Not initialized the account
|
// Not initialized the account
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -450,6 +480,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⛔ *' . $localization['not_authorized_settings'] . '*')
|
$context->sendMessage('⛔ *' . $localization['not_authorized_settings'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -462,6 +494,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -473,6 +507,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -517,6 +553,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⛔ *' . $localization['not_authorized_system_settings'] . '*')
|
$context->sendMessage('⛔ *' . $localization['not_authorized_system_settings'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -529,6 +567,8 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -540,6 +580,81 @@ final class middlewares extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Distributions administration (middleware)
|
||||||
|
*
|
||||||
|
* Check the account for access to distributions administration
|
||||||
|
*
|
||||||
|
* @param context $context
|
||||||
|
* @param node $next
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function distributions_administration(context $context, node $next): void
|
||||||
|
{
|
||||||
|
// Is the process stopped?
|
||||||
|
if ($context->get('stop')) return;
|
||||||
|
|
||||||
|
// Initializing the account
|
||||||
|
$account = $context->get('account');
|
||||||
|
|
||||||
|
if ($account instanceof record) {
|
||||||
|
// Initialized the account
|
||||||
|
|
||||||
|
if ($account->authorized_system_distributions) {
|
||||||
|
// Authorized the account to distributions administration
|
||||||
|
|
||||||
|
// Continuation of the process
|
||||||
|
$next($context);
|
||||||
|
} else {
|
||||||
|
// Not authorized the account to distributions administration
|
||||||
|
|
||||||
|
// Initializing localization
|
||||||
|
$localization = $context->get('localization');
|
||||||
|
|
||||||
|
if ($localization) {
|
||||||
|
// Initialized localization
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⛔ *' . $localization['not_authorized_system_distributions'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Stopping the process
|
||||||
|
$context->set('stop', 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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,911 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace svoboda\svoboder\models\telegram\processes\account\localization;
|
||||||
|
|
||||||
|
// Files of the project
|
||||||
|
use svoboda\svoboder\models\core,
|
||||||
|
svoboda\svoboder\models\account,
|
||||||
|
svoboda\svoboder\models\telegram\account as telegram_account,
|
||||||
|
svoboda\svoboder\models\telegram\buttons\account\localization\create as button_account_localization_create,
|
||||||
|
svoboda\svoboder\models\enumerations\language,
|
||||||
|
svoboda\svoboder\models\telegram\commands;
|
||||||
|
|
||||||
|
// Framework for Telegram
|
||||||
|
use Zanzara\Context as context,
|
||||||
|
Zanzara\Telegram\Type\Message as message;
|
||||||
|
|
||||||
|
// Baza database
|
||||||
|
use mirzaev\baza\record;
|
||||||
|
|
||||||
|
// Build-in libraries
|
||||||
|
use Error as error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Account localization create process
|
||||||
|
*
|
||||||
|
* @package svoboda\svoboder\models\telegram\processes\account\localization
|
||||||
|
*
|
||||||
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||||
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
|
*/
|
||||||
|
final class create extends core
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Process
|
||||||
|
*
|
||||||
|
* @var const string PROCESS Name of the process in the telegram user buffer
|
||||||
|
*/
|
||||||
|
public const string PROCESS = 'account_localization_create';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start
|
||||||
|
*
|
||||||
|
* Starting the account localization creating process
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function start(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
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(static::PROCESS)
|
||||||
|
->then(function (?array $process) use ($context, $account, $language, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($process) {
|
||||||
|
// Found started account localization create process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('📂 *' . $localization['account_localization_create_continiued'] . '*')
|
||||||
|
->then(function (message $message) use ($context, $account, $language, $localization) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Sending the account localization create menu
|
||||||
|
static::menu($context);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not found started account localization create process
|
||||||
|
|
||||||
|
// Initializing buffer of languages
|
||||||
|
$languages = language::cases();
|
||||||
|
|
||||||
|
// Deleting the actual language from buffer of languages
|
||||||
|
unset($languages[array_search($language, $languages, strict: true)]);
|
||||||
|
|
||||||
|
// Sorting buffer of languages by the actual language
|
||||||
|
$languages = [$language, ...$languages];
|
||||||
|
|
||||||
|
// Initializing the account model
|
||||||
|
$model_account = new account;
|
||||||
|
|
||||||
|
// Initializing the account localizations
|
||||||
|
$existed = $model_account->localization->database->read(
|
||||||
|
filter: fn(record $localization) => $localization->account === $account->identifier,
|
||||||
|
amount: ACCOUNT_LOCALIZATION_CREATE_ACCOUNT_LOCALIZATIONS_AMOUNT
|
||||||
|
);
|
||||||
|
|
||||||
|
if (count($existed) !== count(language::cases())) {
|
||||||
|
// Not all languages in the registry have localizations created (expected)
|
||||||
|
|
||||||
|
// Declaring the buffer of languages to exclude
|
||||||
|
$exclude = [];
|
||||||
|
|
||||||
|
// Initializing languages to exclude
|
||||||
|
foreach ($existed as $record) $exclude[] = $record->language;
|
||||||
|
|
||||||
|
if (!empty($exclude)) {
|
||||||
|
// Initialized languages to exclude
|
||||||
|
|
||||||
|
// Deleting excluded languages
|
||||||
|
$languages = array_filter($languages, fn(language $language) => array_search($language->name, $exclude, strict: true) === false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initializing the account localization create buffer
|
||||||
|
$process = [
|
||||||
|
'language' => array_values($languages)[0],
|
||||||
|
'name' => null,
|
||||||
|
];
|
||||||
|
|
||||||
|
// Writing to the telegram user buffer
|
||||||
|
$context->setUserDataItem(static::PROCESS, $process)
|
||||||
|
->then(function () use ($context, $account, $localization) {
|
||||||
|
// Writed to the telegram user buffer
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('📂 *' . $localization['account_localization_create_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context, $account, $localization) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Sending the account localization create menu
|
||||||
|
static::menu($context);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// All languages in the registry have localizations created (expected)
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_create_every_language_created'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} 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 language
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *Failed to initialize language*')
|
||||||
|
->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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel
|
||||||
|
*
|
||||||
|
* Ending the account localization create process
|
||||||
|
* without creating the localization record in the database
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function cancel(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
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(static::PROCESS)
|
||||||
|
->then(function (?array $process) use ($context, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($process) {
|
||||||
|
// Found started account localization create process
|
||||||
|
|
||||||
|
// Deleting in the telegram user buffer
|
||||||
|
$context->deleteUserDataItem(static::PROCESS)
|
||||||
|
->then(function () use ($context, $localization) {
|
||||||
|
// Deleted in the telegram user buffer
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('🗑 *' . $localization['account_localization_create_canceled'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the account localizations menu
|
||||||
|
telegram_account::localizations($context);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not found started account localization create process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_create_not_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the account localizations menu
|
||||||
|
telegram_account::localizations($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} 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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* End
|
||||||
|
*
|
||||||
|
* Ending the account localization create process
|
||||||
|
* and creating the localization record in the database
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function end(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
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(static::PROCESS)
|
||||||
|
->then(function (?array $process) use ($context, $account, $language, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($process) {
|
||||||
|
// Found started account localization create process
|
||||||
|
|
||||||
|
// Initializing the account model
|
||||||
|
$model_account = new account;
|
||||||
|
|
||||||
|
// Creating the account localization
|
||||||
|
$created_localization = $model_account->localization->create(
|
||||||
|
account: $account->identifier,
|
||||||
|
language: $process['language'],
|
||||||
|
name: $process['name']
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($created_localization) {
|
||||||
|
// Created the account localization
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('✏️ *' . $localization['account_localization_create_created'] . '*')
|
||||||
|
->then(function (message $message) use ($context, $account, $language, $localization) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Deleting from the telegram user buffer
|
||||||
|
$context->deleteUserDataItem(static::PROCESS)
|
||||||
|
->then(function () use ($context, $localization) {
|
||||||
|
// Deleted from the telegram user buffer
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('✅ *' . $localization['account_localization_create_completed'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the account localizations menu
|
||||||
|
telegram_account::localizations($context);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not created the account localization
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_create_not_created'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not found started account localization create process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_create_not_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the account localizations menu
|
||||||
|
telegram_account::localizations($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} 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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Menu
|
||||||
|
*
|
||||||
|
* Sends the account localization create menu with parameters: language, name
|
||||||
|
* When all parameters was initialized then sends the complete button
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected static function menu(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) {
|
||||||
|
// Initialized language
|
||||||
|
|
||||||
|
// Initializing localization
|
||||||
|
$localization = $context->get('localization');
|
||||||
|
|
||||||
|
if ($localization) {
|
||||||
|
// Initialized localization
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(static::PROCESS)
|
||||||
|
->then(function (?array $process) use ($context, $account, $language, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($process) {
|
||||||
|
// Found started account localization create process
|
||||||
|
|
||||||
|
// Initializing the buffer of generated keyboard with languages
|
||||||
|
$keyboard = [
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'text' => empty($process['language']) ? '🟢 ' . $localization['account_localization_create_button_language'] : '🟢 ' . $localization['account_localization_create_button_language'] . ': ' . $process['language']->flag() . ' ' . $process['language']->label($language),
|
||||||
|
'callback_data' => 'account_localization_create_language'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'text' => empty($process['name']) ? '🔴 ' . $localization['account_localization_create_button_name'] : '🟢 ' . $localization['account_localization_create_button_name'] . ': ' . $process['name'],
|
||||||
|
'callback_data' => 'account_localization_create_name'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Initializing the index of last row
|
||||||
|
$last = count($keyboard);
|
||||||
|
|
||||||
|
// Initializing the last row
|
||||||
|
$keyboard[$last] ??= [];
|
||||||
|
|
||||||
|
// Initializing the button for canceling the generation process
|
||||||
|
$keyboard[$last][] = [
|
||||||
|
'text' => '❎ ' . $localization['account_localization_create_button_cancel'],
|
||||||
|
'callback_data' => 'account_localization_create_cancel'
|
||||||
|
];
|
||||||
|
|
||||||
|
if (
|
||||||
|
!empty($process['language']) &&
|
||||||
|
!empty($process['name'])
|
||||||
|
) {
|
||||||
|
// Initialized all requeired parameters
|
||||||
|
|
||||||
|
// Initializing the button for completing the generation process
|
||||||
|
$keyboard[$last][] = [
|
||||||
|
'text' => '✅ ' . $localization['account_localization_create_button_confirm'],
|
||||||
|
'callback_data' => 'account_localization_create_end'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation()
|
||||||
|
->then(function () use ($context, $localization, $keyboard) {
|
||||||
|
// Deinitialized the conversation process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage(
|
||||||
|
'📀 *' . $localization['account_localization_create_generation'] . '*',
|
||||||
|
[
|
||||||
|
'reply_markup' => [
|
||||||
|
'inline_keyboard' => $keyboard,
|
||||||
|
'disable_notification' => true,
|
||||||
|
'remove_keyboard' => true
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not found started account localization create process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_create_not_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the account localizations menu
|
||||||
|
telegram_account::localizations($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} 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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Language
|
||||||
|
*
|
||||||
|
* Write language into the account localization create buffer
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
* @param language $new The language
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function language(context $context, language $new): 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
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(static::PROCESS)
|
||||||
|
->then(function (?array $process) use ($context, $account, $language, $localization, $new) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($process) {
|
||||||
|
// Found started account localization create process
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Initializing the old language
|
||||||
|
$old = $process['language'];
|
||||||
|
|
||||||
|
// Writing into the account localization create process buffer
|
||||||
|
$process['language'] = $new;
|
||||||
|
|
||||||
|
// Writing to the telegram user buffer
|
||||||
|
$context->setUserDataItem(static::PROCESS, $process)
|
||||||
|
->then(function () use ($context, $account, $language, $localization, $new, $old) {
|
||||||
|
// Writed to the telegram user buffer
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('✅ *' . $localization['account_localization_create_language_update_success'] . '* ' . ($old->flag() ? $old->flag() . ' ' : '') . $old->label($language) . ' → *' . ($new->flag() ? $new->flag() . ' ' : '') . $new->label($language) . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Sending the account localization create menu
|
||||||
|
static::menu($context);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} catch (error $error) {
|
||||||
|
// Failed to send the message about language update
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('❎ *' . $localization['account_localization_create_language_update_fail'])
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not found started account localization create process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_create_not_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the account localizations menu
|
||||||
|
telegram_account::localizations($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} 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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name
|
||||||
|
*
|
||||||
|
* Write name into the account localization create buffer
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function name(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
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(static::PROCESS)
|
||||||
|
->then(function (?array $process) use ($context, $account, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($process) {
|
||||||
|
// Found started account localization create process
|
||||||
|
|
||||||
|
// Initializing the new name
|
||||||
|
$new = $context->getMessage()->getText();
|
||||||
|
|
||||||
|
if (!empty($new)) {
|
||||||
|
// Initialized the new name
|
||||||
|
|
||||||
|
if (mb_strlen($new) >= 2) {
|
||||||
|
// Passed minimum length check
|
||||||
|
|
||||||
|
if (mb_strlen($new) <= 128) {
|
||||||
|
// Passed maximum length check
|
||||||
|
|
||||||
|
// Search for restricted characters
|
||||||
|
preg_match_all('/[\W\d]/u', $new, $matches);
|
||||||
|
|
||||||
|
// Declaring the buffer of found restricted characters
|
||||||
|
$characters = [];
|
||||||
|
|
||||||
|
foreach ($matches[0] as $match) {
|
||||||
|
// Iterating over found restricted characters
|
||||||
|
|
||||||
|
if (match ($match) {
|
||||||
|
' ', '-' => false,
|
||||||
|
default => true
|
||||||
|
}) {
|
||||||
|
// Found a restricted character
|
||||||
|
|
||||||
|
// Writing into the buffer of found restricted characters
|
||||||
|
$characters[] = $match;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($characters)) {
|
||||||
|
// Not found restricted characters
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Initializing the old name
|
||||||
|
$old = empty($process['name']) ? '_' . $localization['empty'] . '_' : $process['name'];
|
||||||
|
|
||||||
|
// Writing into the account localization create process buffer
|
||||||
|
$process['name'] = $new;
|
||||||
|
|
||||||
|
// Writing to the telegram user buffer
|
||||||
|
$context->setUserDataItem(static::PROCESS, $process)
|
||||||
|
->then(function () use ($context, $account, $localization, $new, $old) {
|
||||||
|
// Writed to the telegram user buffer
|
||||||
|
|
||||||
|
// Escaping characters for markdown
|
||||||
|
$escaped = str_replace('-', '\\-', $new);
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('✅ *' . $localization['account_localization_create_name_update_success'] . "* $old → *$escaped*")
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Sending the account localization create menu
|
||||||
|
static::menu($context);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} catch (error $error) {
|
||||||
|
// Failed to send the message about name update
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('❎ *' . $localization['account_localization_create_name_update_fail'])
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Found restricted characters
|
||||||
|
|
||||||
|
// Initializing title of the message
|
||||||
|
$title = '⚠️ *' . $localization['account_localization_create_name_request_restricted_characters_title'] . '*';
|
||||||
|
|
||||||
|
// Initializing description of the message
|
||||||
|
$description = '*' . $localization['account_localization_create_name_request_restricted_characters_description'] . '* \\' . implode(', \\', $characters);
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage(
|
||||||
|
<<<TXT
|
||||||
|
$title
|
||||||
|
|
||||||
|
$description
|
||||||
|
TXT
|
||||||
|
)
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Requesting to enter name again
|
||||||
|
button_account_localization_create::name($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not passed maximum length check
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_create_name_request_too_long'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Requesting to enter name again
|
||||||
|
button_account_localization_create::name($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not passed minimum length check
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_create_name_request_too_short'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Requesting to enter name again
|
||||||
|
button_account_localization_create::name($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Failed to initialize the new name
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('📄 *' . $localization['account_localization_create_name_request_not_acceptable'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Requesting to enter name again
|
||||||
|
button_account_localization_create::name($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not found started account localization create process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_create_not_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the account localizations menu
|
||||||
|
telegram_account::localizations($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} 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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,776 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace svoboda\svoboder\models\telegram\processes\account\localization;
|
||||||
|
|
||||||
|
// Files of the project
|
||||||
|
use svoboda\svoboder\models\core,
|
||||||
|
svoboda\svoboder\models\account,
|
||||||
|
svoboda\svoboder\models\telegram\account as telegram_account,
|
||||||
|
svoboda\svoboder\models\telegram\buttons\account\localization\update as button_account_localization_update,
|
||||||
|
svoboda\svoboder\models\enumerations\language,
|
||||||
|
svoboda\svoboder\models\telegram\commands;
|
||||||
|
|
||||||
|
// Framework for Telegram
|
||||||
|
use Zanzara\Context as context,
|
||||||
|
Zanzara\Telegram\Type\Message as message;
|
||||||
|
|
||||||
|
// Svoboda time
|
||||||
|
use svoboda\time\statement as svoboda;
|
||||||
|
|
||||||
|
// Baza database
|
||||||
|
use mirzaev\baza\record;
|
||||||
|
|
||||||
|
// Build-in libraries
|
||||||
|
use Error as error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Account localization update process
|
||||||
|
*
|
||||||
|
* @package svoboda\svoboder\models\telegram\processes\account\localization
|
||||||
|
*
|
||||||
|
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
|
||||||
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
|
*/
|
||||||
|
final class update extends core
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Process
|
||||||
|
*
|
||||||
|
* @var const string PROCESS Name of the process in the telegram user buffer
|
||||||
|
*/
|
||||||
|
public const string PROCESS = 'account_localization_update';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start
|
||||||
|
*
|
||||||
|
* Starting the account localization creating process
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
* @param language $target The language
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function start(context $context, language $target): 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
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(static::PROCESS)
|
||||||
|
->then(function (?array $process) use ($context, $account, $language, $target, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($process) {
|
||||||
|
// Found started account localization update process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('📂 *' . $localization['account_localization_update_continiued'] . '*')
|
||||||
|
->then(function (message $message) use ($context, $account, $language, $localization) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Sending the account localization update menu
|
||||||
|
static::menu($context);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not found started account localization update process
|
||||||
|
|
||||||
|
// Initializing the account model
|
||||||
|
$model_account = new account;
|
||||||
|
|
||||||
|
// Initializing the account localization
|
||||||
|
$record = $model_account->localization->database->read(
|
||||||
|
filter: fn(record $localization) => $localization->account === $account->identifier && $localization->language === $target->name,
|
||||||
|
amount: 1
|
||||||
|
)[0] ?? null;
|
||||||
|
|
||||||
|
if ($record instanceof record) {
|
||||||
|
// Initialized the account localization
|
||||||
|
|
||||||
|
// Initializing the account localization update buffer
|
||||||
|
$process = [
|
||||||
|
'record' => $record,
|
||||||
|
'language' => $target,
|
||||||
|
'name' => $record?->name,
|
||||||
|
];
|
||||||
|
|
||||||
|
// Writing to the telegram user buffer
|
||||||
|
$context->setUserDataItem(static::PROCESS, $process)
|
||||||
|
->then(function () use ($context, $account, $localization) {
|
||||||
|
// Writed to the telegram user buffer
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('📂 *' . $localization['account_localization_update_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context, $account, $localization) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Sending the account localization update menu
|
||||||
|
static::menu($context);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not initialized the account localization
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_update_not_initialized_localization'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} 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 language
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *Failed to initialize language*')
|
||||||
|
->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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel
|
||||||
|
*
|
||||||
|
* Ending the account localization update process
|
||||||
|
* without creating the localization record in the database
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function cancel(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
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(static::PROCESS)
|
||||||
|
->then(function (?array $process) use ($context, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($process) {
|
||||||
|
// Found started account localization update process
|
||||||
|
|
||||||
|
// Deleting in the telegram user buffer
|
||||||
|
$context->deleteUserDataItem(static::PROCESS)
|
||||||
|
->then(function () use ($context, $localization) {
|
||||||
|
// Deleted in the telegram user buffer
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('🗑 *' . $localization['account_localization_update_canceled'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the account localizations menu
|
||||||
|
telegram_account::localizations($context);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not found started account localization update process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_update_not_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the account localizations menu
|
||||||
|
telegram_account::localizations($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} 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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* End
|
||||||
|
*
|
||||||
|
* Ending the account localization update process
|
||||||
|
* and creating the localization record in the database
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function end(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
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(static::PROCESS)
|
||||||
|
->then(function (?array $process) use ($context, $account, $language, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($process) {
|
||||||
|
// Found started account localization update process
|
||||||
|
|
||||||
|
// Initializing the account model
|
||||||
|
$model_account = new account;
|
||||||
|
|
||||||
|
// Updating the account localization
|
||||||
|
$updated_localization = $model_account->localization->database->read(
|
||||||
|
filter: fn(record $localization) => $localization->identifier === $process['record']->identifier,
|
||||||
|
update: function (record &$localization) use ($process) {
|
||||||
|
$localization->name = $process['name'];
|
||||||
|
$localization->updated = svoboda::timestamp();
|
||||||
|
},
|
||||||
|
amount: 1
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($updated_localization) {
|
||||||
|
// Updated the account localization
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('✏️ *' . $localization['account_localization_update_updated'] . '*')
|
||||||
|
->then(function (message $message) use ($context, $account, $language, $localization) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Deleting from the telegram user buffer
|
||||||
|
$context->deleteUserDataItem(static::PROCESS)
|
||||||
|
->then(function () use ($context, $localization) {
|
||||||
|
// Deleted from the telegram user buffer
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('✅ *' . $localization['account_localization_update_completed'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the account localizations menu
|
||||||
|
telegram_account::localizations($context);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not updated the account localization
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_update_not_updated'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not found started account localization update process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_update_not_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the account localizations menu
|
||||||
|
telegram_account::localizations($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} 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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Menu
|
||||||
|
*
|
||||||
|
* Sends the account localization update menu with parameters: language, name
|
||||||
|
* When all parameters was initialized then sends the complete button
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected static function menu(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) {
|
||||||
|
// Initialized language
|
||||||
|
|
||||||
|
// Initializing localization
|
||||||
|
$localization = $context->get('localization');
|
||||||
|
|
||||||
|
if ($localization) {
|
||||||
|
// Initialized localization
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(static::PROCESS)
|
||||||
|
->then(function (?array $process) use ($context, $account, $language, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($process) {
|
||||||
|
// Found started account localization update process
|
||||||
|
|
||||||
|
// Initializing the buffer of generated keyboard with languages
|
||||||
|
$keyboard = [
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'text' => empty($process['name']) ? '🔴 ' . $localization['account_localization_update_button_name'] : '🟢 ' . $localization['account_localization_update_button_name'] . ': ' . $process['name'],
|
||||||
|
'callback_data' => 'account_localization_update_name'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Initializing the index of last row
|
||||||
|
$last = count($keyboard);
|
||||||
|
|
||||||
|
// Initializing the last row
|
||||||
|
$keyboard[$last] ??= [];
|
||||||
|
|
||||||
|
// Initializing the button for canceling the generation process
|
||||||
|
$keyboard[$last][] = [
|
||||||
|
'text' => '❎ ' . $localization['account_localization_update_button_cancel'],
|
||||||
|
'callback_data' => 'account_localization_update_cancel'
|
||||||
|
];
|
||||||
|
|
||||||
|
if (
|
||||||
|
!empty($process['record']) &&
|
||||||
|
!empty($process['name'])
|
||||||
|
) {
|
||||||
|
// Initialized all requeired parameters
|
||||||
|
|
||||||
|
// Initializing the button for completing the generation process
|
||||||
|
$keyboard[$last][] = [
|
||||||
|
'text' => '✅ ' . $localization['account_localization_update_button_confirm'],
|
||||||
|
'callback_data' => 'account_localization_update_end'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation()
|
||||||
|
->then(function () use ($context, $language, $localization, $keyboard, $process) {
|
||||||
|
// Deinitialized the conversation process
|
||||||
|
|
||||||
|
// Initializing the message title
|
||||||
|
$title = '📀 *' . $localization['account_localization_update_generation'] . '*';
|
||||||
|
|
||||||
|
// Initializing the message target
|
||||||
|
$target = '*' . $localization['account_localization_update_generation_target'] . ':* ' . $process['language']->flag() . ' *' . $process['language']->label($language) . '* \(' . $process['record']->identifier . '\)';
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage(
|
||||||
|
<<<TXT
|
||||||
|
$title
|
||||||
|
|
||||||
|
$target
|
||||||
|
TXT,
|
||||||
|
[
|
||||||
|
'reply_markup' => [
|
||||||
|
'inline_keyboard' => $keyboard,
|
||||||
|
'disable_notification' => true,
|
||||||
|
'remove_keyboard' => true
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Not found started account localization update process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_update_not_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the account localizations menu
|
||||||
|
telegram_account::localizations($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} 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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name
|
||||||
|
*
|
||||||
|
* Write name into the account localization update buffer
|
||||||
|
*
|
||||||
|
* @param context $context Request data from Telegram
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function name(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
|
||||||
|
|
||||||
|
// Reading from the telegram user buffer
|
||||||
|
$context->getUserDataItem(static::PROCESS)
|
||||||
|
->then(function (?array $process) use ($context, $account, $localization) {
|
||||||
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
|
if ($process) {
|
||||||
|
// Found started account localization update process
|
||||||
|
|
||||||
|
// Initializing the new name
|
||||||
|
$new = $context->getMessage()->getText();
|
||||||
|
|
||||||
|
if (!empty($new)) {
|
||||||
|
// Initialized the new name
|
||||||
|
|
||||||
|
if (mb_strlen($new) >= 2) {
|
||||||
|
// Passed minimum length check
|
||||||
|
|
||||||
|
if (mb_strlen($new) <= 128) {
|
||||||
|
// Passed maximum length check
|
||||||
|
|
||||||
|
// Search for restricted characters
|
||||||
|
preg_match_all('/[\W\d]/u', $new, $matches);
|
||||||
|
|
||||||
|
// Declaring the buffer of found restricted characters
|
||||||
|
$characters = [];
|
||||||
|
|
||||||
|
foreach ($matches[0] as $match) {
|
||||||
|
// Iterating over found restricted characters
|
||||||
|
|
||||||
|
if (match ($match) {
|
||||||
|
' ', '-' => false,
|
||||||
|
default => true
|
||||||
|
}) {
|
||||||
|
// Found a restricted character
|
||||||
|
|
||||||
|
// Writing into the buffer of found restricted characters
|
||||||
|
$characters[] = $match;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($characters)) {
|
||||||
|
// Not found restricted characters
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Initializing the old name
|
||||||
|
$old = empty($process['name']) ? '_' . $localization['empty'] . '_' : $process['name'];
|
||||||
|
|
||||||
|
// Writing into the account localization update process buffer
|
||||||
|
$process['name'] = $new;
|
||||||
|
|
||||||
|
// Writing to the telegram user buffer
|
||||||
|
$context->setUserDataItem(static::PROCESS, $process)
|
||||||
|
->then(function () use ($context, $account, $localization, $new, $old) {
|
||||||
|
// Writed to the telegram user buffer
|
||||||
|
|
||||||
|
// Escaping characters for markdown
|
||||||
|
$escaped = str_replace('-', '\\-', $new);
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('✅ *' . $localization['account_localization_update_name_update_success'] . "* $old → *$escaped*")
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Sending the account localization update menu
|
||||||
|
static::menu($context);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} catch (error $error) {
|
||||||
|
// Failed to send the message about name update
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('❎ *' . $localization['account_localization_update_name_update_fail'])
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Found restricted characters
|
||||||
|
|
||||||
|
// Initializing title of the message
|
||||||
|
$title = '⚠️ *' . $localization['account_localization_update_name_request_restricted_characters_title'] . '*';
|
||||||
|
|
||||||
|
// Initializing description of the message
|
||||||
|
$description = '*' . $localization['account_localization_update_name_request_restricted_characters_description'] . '* \\' . implode(', \\', $characters);
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage(
|
||||||
|
<<<TXT
|
||||||
|
$title
|
||||||
|
|
||||||
|
$description
|
||||||
|
TXT
|
||||||
|
)
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Requesting to enter name again
|
||||||
|
button_account_localization_update::name($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not passed maximum length check
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_update_name_request_too_long'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Requesting to enter name again
|
||||||
|
button_account_localization_update::name($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not passed minimum length check
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_update_name_request_too_short'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Requesting to enter name again
|
||||||
|
button_account_localization_update::name($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Failed to initialize the new name
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('📄 *' . $localization['account_localization_update_name_request_not_acceptable'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Requesting to enter name again
|
||||||
|
button_account_localization_update::name($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Not found started account localization update process
|
||||||
|
|
||||||
|
// Sending the message
|
||||||
|
$context->sendMessage('⚠️ *' . $localization['account_localization_update_not_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the account localizations menu
|
||||||
|
telegram_account::localizations($context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} 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 your Telegram account*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,11 +7,9 @@ namespace svoboda\svoboder\models\telegram\processes\distribution;
|
||||||
// Files of the project
|
// Files of the project
|
||||||
use svoboda\svoboder\models\core,
|
use svoboda\svoboder\models\core,
|
||||||
svoboda\svoboder\models\distribution,
|
svoboda\svoboder\models\distribution,
|
||||||
svoboda\svoboder\models\localizations\distribution as distribution_localization,
|
|
||||||
svoboda\svoboder\models\enumerations\language,
|
svoboda\svoboder\models\enumerations\language,
|
||||||
svoboda\svoboder\models\telegram\commands,
|
svoboda\svoboder\models\telegram\commands,
|
||||||
svoboda\svoboder\models\telegram\processes\distribution\localization,
|
svoboda\svoboder\models\telegram\buttons\distribution\declaration as button_distribution_declaration;
|
||||||
svoboda\svoboder\models\telegram\buttons\distribution\registration as button_distribution_registration;
|
|
||||||
|
|
||||||
// Framework for Telegram
|
// Framework for Telegram
|
||||||
use Zanzara\Context as context,
|
use Zanzara\Context as context,
|
||||||
|
@ -24,19 +22,26 @@ use mirzaev\baza\record;
|
||||||
use Error as error;
|
use Error as error;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Distribution registration process
|
* Distribution declaration process
|
||||||
*
|
*
|
||||||
* @package svoboda\svoboder\models\telegram\processes\distribution
|
* @package svoboda\svoboder\models\telegram\processes\distribution
|
||||||
*
|
*
|
||||||
* @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 registration extends core
|
final class declaration extends core
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Process
|
||||||
|
*
|
||||||
|
* @var const string PROCESS Name of the process in the telegram user buffer
|
||||||
|
*/
|
||||||
|
public const string PROCESS = 'distribution_declaration';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start
|
* Start
|
||||||
*
|
*
|
||||||
* Starting the distribution registration process
|
* Starting the distribution declaration process
|
||||||
*
|
*
|
||||||
* @param context $context Request data from Telegram
|
* @param context $context Request data from Telegram
|
||||||
*
|
*
|
||||||
|
@ -63,25 +68,25 @@ final class registration extends core
|
||||||
// Initialized localization
|
// Initialized localization
|
||||||
|
|
||||||
// Reading from the telegram user buffer
|
// Reading from the telegram user buffer
|
||||||
$context->getUserDataItem('distribution_registration')
|
$context->getUserDataItem(static::PROCESS)
|
||||||
->then(function ($distribution) use ($context, $account, $language, $localization) {
|
->then(function (?array $distribution) use ($context, $account, $language, $localization) {
|
||||||
// Readed from the telegram user buffer
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
if ($distribution) {
|
if ($distribution) {
|
||||||
// Found started registration process
|
// Found started distribution declaration process
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('📂 *' . $localization['distribution_registration_continiued'] . '*')
|
$context->sendMessage('📂 *' . $localization[static::PROCESS . '_continiued'] . '*')
|
||||||
->then(function (message $message) use ($context, $account, $language, $localization) {
|
->then(function (message $message) use ($context, $account, $language, $localization) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
// Sending the generation menu
|
// Sending the distribution declaration menu
|
||||||
static::generation($context);
|
static::menu($context);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Not found started registretion process
|
// Not found started distribution declaration process
|
||||||
|
|
||||||
// Initializing the distribution registration buffer
|
// Initializing the distribution declaration buffer
|
||||||
$distribution = [
|
$distribution = [
|
||||||
'latitude' => null,
|
'latitude' => null,
|
||||||
'longitude' => null,
|
'longitude' => null,
|
||||||
|
@ -92,17 +97,17 @@ final class registration extends core
|
||||||
];
|
];
|
||||||
|
|
||||||
// Writing to the telegram user buffer
|
// Writing to the telegram user buffer
|
||||||
$context->setUserDataItem('distribution_registration', $distribution)
|
$context->setUserDataItem(static::PROCESS, $distribution)
|
||||||
->then(function () use ($context, $account, $localization) {
|
->then(function () use ($context, $account, $localization) {
|
||||||
// Writed to the telegram user buffer
|
// Writed to the telegram user buffer
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('📂 *' . $localization['distribution_registration_started'] . '*')
|
$context->sendMessage('📂 *' . $localization[static::PROCESS . '_started'] . '*')
|
||||||
->then(function (message $message) use ($context, $account, $localization) {
|
->then(function (message $message) use ($context, $account, $localization) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
// Sending the generation menu
|
// Sending the distribution declaration menu
|
||||||
static::generation($context);
|
static::menu($context);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -142,7 +147,7 @@ final class registration extends core
|
||||||
/**
|
/**
|
||||||
* Cancel
|
* Cancel
|
||||||
*
|
*
|
||||||
* Ending the distribution registration process
|
* Ending the distribution declaration process
|
||||||
* without creating the distribution record in the database
|
* without creating the distribution record in the database
|
||||||
*
|
*
|
||||||
* @param context $context Request data from Telegram
|
* @param context $context Request data from Telegram
|
||||||
|
@ -164,20 +169,20 @@ final class registration extends core
|
||||||
// Initialized localization
|
// Initialized localization
|
||||||
|
|
||||||
// Reading from the telegram user buffer
|
// Reading from the telegram user buffer
|
||||||
$context->getUserDataItem('distribution_registration')
|
$context->getUserDataItem(static::PROCESS)
|
||||||
->then(function ($distribution) use ($context, $localization) {
|
->then(function (?array $distribution) use ($context, $localization) {
|
||||||
// Readed from the telegram user buffer
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
if ($distribution) {
|
if ($distribution) {
|
||||||
// Found started registration process
|
// Found started distribution declaration process
|
||||||
|
|
||||||
// Deleting in the telegram user buffer
|
// Deleting in the telegram user buffer
|
||||||
$context->deleteUserDataItem('distribution_registration')
|
$context->deleteUserDataItem(static::PROCESS)
|
||||||
->then(function () use ($context, $localization) {
|
->then(function () use ($context, $localization) {
|
||||||
// Deleted in the telegram user buffer
|
// Deleted in the telegram user buffer
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('🗑 *' . $localization['distribution_registration_canceled'] . '*')
|
$context->sendMessage('🗑 *' . $localization[static::PROCESS . '_canceled'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
|
@ -189,10 +194,19 @@ final class registration extends core
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Not found started registretion process
|
// Not found started distribution declaration process
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
|
$context->sendMessage('⚠️ *' . $localization[static::PROCESS . '_not_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the distributions menu
|
||||||
|
commands::distributions($context);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -224,7 +238,7 @@ final class registration extends core
|
||||||
/**
|
/**
|
||||||
* End
|
* End
|
||||||
*
|
*
|
||||||
* Ending the distribution registration process
|
* Ending the distribution declaration process
|
||||||
* and creating the distribution record in the database
|
* and creating the distribution record in the database
|
||||||
*
|
*
|
||||||
* @param context $context Request data from Telegram
|
* @param context $context Request data from Telegram
|
||||||
|
@ -252,16 +266,18 @@ final class registration extends core
|
||||||
// Initialized localization
|
// Initialized localization
|
||||||
|
|
||||||
// Reading from the telegram user buffer
|
// Reading from the telegram user buffer
|
||||||
$context->getUserDataItem('distribution_registration')
|
$context->getUserDataItem(static::PROCESS)
|
||||||
->then(function ($distribution) use ($context, $account, $language, $localization) {
|
->then(function (?array $distribution) use ($context, $account, $language, $localization) {
|
||||||
// Readed from the telegram user buffer
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
if ($distribution) {
|
if ($distribution) {
|
||||||
// Found started registration process
|
// Found started distribution declaration process
|
||||||
|
|
||||||
|
// Initializing the distribution model
|
||||||
|
$model_distribution = new distribution;
|
||||||
|
|
||||||
// Creating the distribution
|
// Creating the distribution
|
||||||
/* $created_distribution = new distribution->create( */
|
$created_distribution = $model_distribution->create(
|
||||||
$created_distribution = (new distribution)->create(
|
|
||||||
creator: $account->identifier,
|
creator: $account->identifier,
|
||||||
latitude: $distribution['latitude'],
|
latitude: $distribution['latitude'],
|
||||||
longitude: $distribution['longitude']
|
longitude: $distribution['longitude']
|
||||||
|
@ -271,13 +287,12 @@ final class registration extends core
|
||||||
// Created the distribution
|
// Created the distribution
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('✏️ *' . $localization['distribution_registration_created_distribution'] . '*')
|
$context->sendMessage('✏️ *' . $localization[static::PROCESS . '_created_distribution'] . '*')
|
||||||
->then(function (message $message) use ($context, $account, $language, $localization, $distribution, $created_distribution) {
|
->then(function (message $message) use ($context, $account, $language, $localization, $distribution, $model_distribution, $created_distribution) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
// Initializing the distribution localization
|
// Initializing the distribution localization
|
||||||
/* $created_localization = new distribution_localization->create( */
|
$created_localization = $model_distribution->localization->create(
|
||||||
$created_localization = (new distribution_localization)->create(
|
|
||||||
distribution: $created_distribution,
|
distribution: $created_distribution,
|
||||||
language: $distribution['localization']['language'],
|
language: $distribution['localization']['language'],
|
||||||
name: $distribution['localization']['name']
|
name: $distribution['localization']['name']
|
||||||
|
@ -287,17 +302,17 @@ final class registration extends core
|
||||||
// Created the localization
|
// Created the localization
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('✏️ *' . $localization['distribution_registration_created_localization'] . '*')
|
$context->sendMessage('✏️ *' . $localization[static::PROCESS . '_created_localization'] . '*')
|
||||||
->then(function (message $message) use ($context, $localization) {
|
->then(function (message $message) use ($context, $localization) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
// Deleting from the telegram user buffer
|
// Deleting from the telegram user buffer
|
||||||
$context->deleteUserDataItem('distribution_registration')
|
$context->deleteUserDataItem(static::PROCESS)
|
||||||
->then(function () use ($context, $localization) {
|
->then(function () use ($context, $localization) {
|
||||||
// Deleted from the telegram user buffer
|
// Deleted from the telegram user buffer
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('✅ *' . $localization['distribution_registration_completed'] . '*')
|
$context->sendMessage('✅ *' . $localization[static::PROCESS . '_completed'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
|
@ -313,7 +328,7 @@ final class registration extends core
|
||||||
// Not created the distribution localization
|
// Not created the distribution localization
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_not_created_localization'] . '*')
|
$context->sendMessage('⚠️ *' . $localization[static::PROCESS . '_not_created_localization'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
|
@ -326,7 +341,7 @@ final class registration extends core
|
||||||
// Not created the distribution
|
// Not created the distribution
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_not_created_distribution'] . '*')
|
$context->sendMessage('⚠️ *' . $localization[static::PROCESS . '_not_created_distribution'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
|
@ -335,10 +350,13 @@ final class registration extends core
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not found started registretion process
|
// Not found started distribution declaration process
|
||||||
|
|
||||||
// Sending the message
|
// Ending the conversation process
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the distributions menu
|
||||||
|
commands::distributions($context);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -382,14 +400,14 @@ final class registration extends core
|
||||||
/**
|
/**
|
||||||
* Generation
|
* Generation
|
||||||
*
|
*
|
||||||
* Sends the generation menu with parameters: language, name, location
|
* Sends the distribution declaration menu with parameters: language, name, location
|
||||||
* When all parameters was initialized then sends the complete button
|
* When all parameters was initialized then sends the complete button
|
||||||
*
|
*
|
||||||
* @param context $context Request data from Telegram
|
* @param context $context Request data from Telegram
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected static function generation(context $context): void
|
protected static function menu(context $context): void
|
||||||
{
|
{
|
||||||
// Initializing the account
|
// Initializing the account
|
||||||
$account = $context->get('account');
|
$account = $context->get('account');
|
||||||
|
@ -410,31 +428,31 @@ final class registration extends core
|
||||||
// Initialized localization
|
// Initialized localization
|
||||||
|
|
||||||
// Reading from the telegram user buffer
|
// Reading from the telegram user buffer
|
||||||
$context->getUserDataItem('distribution_registration')
|
$context->getUserDataItem(static::PROCESS)
|
||||||
->then(function ($distribution) use ($context, $account, $language, $localization) {
|
->then(function (?array $distribution) use ($context, $account, $language, $localization) {
|
||||||
// Readed from the telegram user buffer
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
if ($distribution) {
|
if ($distribution) {
|
||||||
// Found started registration process
|
// Found started distribution declaration process
|
||||||
|
|
||||||
// Initializing the buffer of generated keyboard with languages
|
// Initializing the buffer of generated keyboard with languages
|
||||||
$keyboard = [
|
$keyboard = [
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => empty($distribution['localization']['language']) ? '🟢 ' . $localization['distribution_registration_button_language'] : '🟢 ' . $localization['distribution_registration_button_language'] . ': ' . $distribution['localization']['language']->flag() . ' ' . $distribution['localization']['language']->label($language),
|
'text' => empty($distribution['localization']['language']) ? '🟢 ' . $localization[static::PROCESS . '_button_language'] : '🟢 ' . $localization['distribution_declaration_button_language'] . ': ' . $distribution['localization']['language']->flag() . ' ' . $distribution['localization']['language']->label($language),
|
||||||
'callback_data' => 'distribution_registration_language'
|
'callback_data' => static::PROCESS . '_language'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => empty($distribution['localization']['name']) ? '🔴 ' . $localization['distribution_registration_button_name'] : '🟢 ' . $localization['distribution_registration_button_name'] . ': ' . $distribution['localization']['name'],
|
'text' => empty($distribution['localization']['name']) ? '🔴 ' . $localization[static::PROCESS . '_button_name'] : '🟢 ' . $localization['distribution_declaration_button_name'] . ': ' . $distribution['localization']['name'],
|
||||||
'callback_data' => 'distribution_registration_name'
|
'callback_data' => static::PROCESS . '_name'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
'text' => empty($distribution['latitude']) || empty('longitude') ? '🔴 ' . $localization['distribution_registration_button_location'] : '🟢 ' . $localization['distribution_registration_button_location'] . ': ' . $distribution['latitude'] . ', ' . $distribution['longitude'],
|
'text' => empty($distribution['latitude']) || empty('longitude') ? '🔴 ' . $localization[static::PROCESS . '_button_location'] : '🟢 ' . $localization['distribution_declaration_button_location'] . ': ' . $distribution['latitude'] . ', ' . $distribution['longitude'],
|
||||||
'callback_data' => 'distribution_registration_location'
|
'callback_data' => static::PROCESS . '_location'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
@ -447,8 +465,8 @@ final class registration extends core
|
||||||
|
|
||||||
// Initializing the button for canceling the generation process
|
// Initializing the button for canceling the generation process
|
||||||
$keyboard[$last][] = [
|
$keyboard[$last][] = [
|
||||||
'text' => '❎ ' . $localization['distribution_registration_button_cancel'],
|
'text' => '❎ ' . $localization[static::PROCESS . '_button_cancel'],
|
||||||
'callback_data' => 'distribution_registration_cancel'
|
'callback_data' => static::PROCESS . '_cancel'
|
||||||
];
|
];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -461,8 +479,8 @@ final class registration extends core
|
||||||
|
|
||||||
// Initializing the button for completing the generation process
|
// Initializing the button for completing the generation process
|
||||||
$keyboard[$last][] = [
|
$keyboard[$last][] = [
|
||||||
'text' => '✅ ' . $localization['distribution_registration_button_confirm'],
|
'text' => '✅ ' . $localization[static::PROCESS . '_button_confirm'],
|
||||||
'callback_data' => 'distribution_registration_end'
|
'callback_data' => static::PROCESS . '_end'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,7 +491,7 @@ final class registration extends core
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage(
|
$context->sendMessage(
|
||||||
'📀 *' . $localization['distribution_registration_generation'] . '*',
|
'📀 *' . $localization[static::PROCESS . '_generation'] . '*',
|
||||||
[
|
[
|
||||||
'reply_markup' => [
|
'reply_markup' => [
|
||||||
'inline_keyboard' => $keyboard,
|
'inline_keyboard' => $keyboard,
|
||||||
|
@ -484,10 +502,19 @@ final class registration extends core
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Not found started registretion process
|
// Not found started distribution declaration process
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
|
$context->sendMessage('⚠️ *' . $localization[static::PROCESS . '_not_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the distributions menu
|
||||||
|
commands::distributions($context);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -525,7 +552,7 @@ final class registration extends core
|
||||||
/**
|
/**
|
||||||
* Language
|
* Language
|
||||||
*
|
*
|
||||||
* Write language into the distribution registration buffer
|
* Write language into the distribution declaration buffer
|
||||||
*
|
*
|
||||||
* @param context $context Request data from Telegram
|
* @param context $context Request data from Telegram
|
||||||
* @param language $new The language
|
* @param language $new The language
|
||||||
|
@ -553,49 +580,58 @@ final class registration extends core
|
||||||
// Initialized localization
|
// Initialized localization
|
||||||
|
|
||||||
// Reading from the telegram user buffer
|
// Reading from the telegram user buffer
|
||||||
$context->getUserDataItem('distribution_registration')
|
$context->getUserDataItem(static::PROCESS)
|
||||||
->then(function ($distribution) use ($context, $account, $language, $localization, $new) {
|
->then(function (?array $distribution) use ($context, $account, $language, $localization, $new) {
|
||||||
// Readed from the telegram user buffer
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
if ($distribution) {
|
if ($distribution) {
|
||||||
// Found started registration process
|
// Found started distribution declaration process
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Initializing the old language
|
// Initializing the old language
|
||||||
$old = $distribution['localization']['language'];
|
$old = $distribution['localization']['language'];
|
||||||
|
|
||||||
// Writing into the distribution registration process buffer
|
// Writing into the distribution declaration process buffer
|
||||||
$distribution['localization']['language'] = $new;
|
$distribution['localization']['language'] = $new;
|
||||||
|
|
||||||
// Writing to the telegram user buffer
|
// Writing to the telegram user buffer
|
||||||
$context->setUserDataItem('distribution_registration', $distribution)
|
$context->setUserDataItem(static::PROCESS, $distribution)
|
||||||
->then(function () use ($context, $account, $language, $localization, $new, $old) {
|
->then(function () use ($context, $account, $language, $localization, $new, $old) {
|
||||||
// Writed to the telegram user buffer
|
// Writed to the telegram user buffer
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('✅ *' . $localization['distribution_registration_language_update_success'] . '* ' . ($old->flag() ? $old->flag() . ' ' : '') . $old->label($language) . ' → *' . ($new->flag() ? $new->flag() . ' ' : '') . $new->label($language) . '*')
|
$context->sendMessage('✅ *' . $localization[static::PROCESS . '_language_update_success'] . '* ' . ($old->flag() ? $old->flag() . ' ' : '') . $old->label($language) . ' → *' . ($new->flag() ? $new->flag() . ' ' : '') . $new->label($language) . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
// Sending the generation menu
|
// Sending the distribution declaration menu
|
||||||
static::generation($context);
|
static::menu($context);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (error $error) {
|
} catch (error $error) {
|
||||||
// Failed to send the message about language update
|
// Failed to send the message about language update
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('❎ *' . $localization['distribution_registration_language_update_fail'])
|
$context->sendMessage('❎ *' . $localization[static::PROCESS . '_language_update_fail'])
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not found started registretion process
|
// Not found started distribution declaration process
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
|
$context->sendMessage('⚠️ *' . $localization[static::PROCESS . '_not_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the distributions menu
|
||||||
|
commands::distributions($context);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -633,7 +669,7 @@ final class registration extends core
|
||||||
/**
|
/**
|
||||||
* Name
|
* Name
|
||||||
*
|
*
|
||||||
* Write name into the distribution registration buffer
|
* Write name into the distribution declaration buffer
|
||||||
*
|
*
|
||||||
* @param context $context Request data from Telegram
|
* @param context $context Request data from Telegram
|
||||||
*
|
*
|
||||||
|
@ -654,12 +690,12 @@ final class registration extends core
|
||||||
// Initialized localization
|
// Initialized localization
|
||||||
|
|
||||||
// Reading from the telegram user buffer
|
// Reading from the telegram user buffer
|
||||||
$context->getUserDataItem('distribution_registration')
|
$context->getUserDataItem(static::PROCESS)
|
||||||
->then(function ($distribution) use ($context, $account, $localization) {
|
->then(function (?array $distribution) use ($context, $account, $localization) {
|
||||||
// Readed from the telegram user buffer
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
if ($distribution) {
|
if ($distribution) {
|
||||||
// Found started registration process
|
// Found started distribution declaration process
|
||||||
|
|
||||||
// Initializing the new name
|
// Initializing the new name
|
||||||
$new = $context->getMessage()->getText();
|
$new = $context->getMessage()->getText();
|
||||||
|
@ -670,7 +706,7 @@ final class registration extends core
|
||||||
if (mb_strlen($new) >= 3) {
|
if (mb_strlen($new) >= 3) {
|
||||||
// Passed minimum length check
|
// Passed minimum length check
|
||||||
|
|
||||||
if (mb_strlen($new) <= 32) {
|
if (mb_strlen($new) <= 64) {
|
||||||
// Passed maximum length check
|
// Passed maximum length check
|
||||||
|
|
||||||
// Search for restricted characters
|
// Search for restricted characters
|
||||||
|
@ -708,28 +744,28 @@ final class registration extends core
|
||||||
// Initializing the old name
|
// Initializing the old name
|
||||||
$old = empty($distribution['localization']['name']) ? '_' . $localization['empty'] . '_' : $distribution['localization']['name'];
|
$old = empty($distribution['localization']['name']) ? '_' . $localization['empty'] . '_' : $distribution['localization']['name'];
|
||||||
|
|
||||||
// Writing into the distribution registration process buffer
|
// Writing into the distribution declaration process buffer
|
||||||
$distribution['localization']['name'] = $new;
|
$distribution['localization']['name'] = $new;
|
||||||
|
|
||||||
// Writing to the telegram user buffer
|
// Writing to the telegram user buffer
|
||||||
$context->setUserDataItem('distribution_registration', $distribution)
|
$context->setUserDataItem(static::PROCESS, $distribution)
|
||||||
->then(function () use ($context, $account, $localization, $new, $old) {
|
->then(function () use ($context, $account, $localization, $new, $old) {
|
||||||
// Writed to the telegram user buffer
|
// Writed to the telegram user buffer
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('✅ *' . $localization['distribution_registration_name_update_success'] . "* $old → *$new*")
|
$context->sendMessage('✅ *' . $localization[static::PROCESS . '_name_update_success'] . "* $old → *$new*")
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
// Sending the generation menu
|
// Sending the distribution declaration menu
|
||||||
static::generation($context);
|
static::menu($context);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (error $error) {
|
} catch (error $error) {
|
||||||
// Failed to send the message about name update
|
// Failed to send the message about name update
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('❎ *' . $localization['distribution_registration_name_update_fail'])
|
$context->sendMessage('❎ *' . $localization[static::PROCESS . '_name_update_fail'])
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
|
@ -739,7 +775,7 @@ final class registration extends core
|
||||||
// Number of spaces is more than 2
|
// Number of spaces is more than 2
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_name_request_spaces'] . '*')
|
$context->sendMessage('⚠️ *' . $localization[static::PROCESS . '_name_request_spaces'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
|
@ -747,17 +783,17 @@ final class registration extends core
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
|
|
||||||
// Requesting to enter name again
|
// Requesting to enter name again
|
||||||
button_distribution_registration::name($context);
|
button_distribution_declaration::name($context);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Found restricted characters
|
// Found restricted characters
|
||||||
|
|
||||||
// Initializing title of the message
|
// Initializing title of the message
|
||||||
$title = '⚠️ *' . $localization['distribution_registration_name_request_restricted_characters_title'] . '*';
|
$title = '⚠️ *' . $localization[static::PROCESS . '_name_request_restricted_characters_title'] . '*';
|
||||||
|
|
||||||
// Initializing description of the message
|
// Initializing description of the message
|
||||||
$description = '*' . $localization['distribution_registration_name_request_restricted_characters_description'] . '* \\' . implode(', \\', $characters);
|
$description = '*' . $localization[static::PROCESS . '_name_request_restricted_characters_description'] . '* \\' . implode(', \\', $characters);
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage(
|
$context->sendMessage(
|
||||||
|
@ -774,14 +810,14 @@ final class registration extends core
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
|
|
||||||
// Requesting to enter name again
|
// Requesting to enter name again
|
||||||
button_distribution_registration::name($context);
|
button_distribution_declaration::name($context);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not passed maximum length check
|
// Not passed maximum length check
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_name_request_too_long'] . '*')
|
$context->sendMessage('⚠️ *' . $localization[static::PROCESS . '_name_request_too_long'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
|
@ -789,14 +825,14 @@ final class registration extends core
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
|
|
||||||
// Requesting to enter name again
|
// Requesting to enter name again
|
||||||
button_distribution_registration::name($context);
|
button_distribution_declaration::name($context);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not passed minimum length check
|
// Not passed minimum length check
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_name_request_too_short'] . '*')
|
$context->sendMessage('⚠️ *' . $localization[static::PROCESS . '_name_request_too_short'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
|
@ -804,14 +840,14 @@ final class registration extends core
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
|
|
||||||
// Requesting to enter name again
|
// Requesting to enter name again
|
||||||
button_distribution_registration::name($context);
|
button_distribution_declaration::name($context);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Failed to initialize the new name
|
// Failed to initialize the new name
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('📄 *' . $localization['distribution_registration_name_request_not_acceptable'] . '*')
|
$context->sendMessage('📄 *' . $localization[static::PROCESS . '_name_request_not_acceptable'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
|
@ -819,14 +855,23 @@ final class registration extends core
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
|
|
||||||
// Requesting to enter name again
|
// Requesting to enter name again
|
||||||
button_distribution_registration::name($context);
|
button_distribution_declaration::name($context);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not found started registretion process
|
// Not found started distribution declaration process
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
|
$context->sendMessage('⚠️ *' . $localization[static::PROCESS . '_not_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the distributions menu
|
||||||
|
commands::distributions($context);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -854,7 +899,7 @@ final class registration extends core
|
||||||
/**
|
/**
|
||||||
* Location
|
* Location
|
||||||
*
|
*
|
||||||
* Write latitude and longitude into the distribution registration buffer
|
* Write latitude and longitude into the distribution declaration buffer
|
||||||
*
|
*
|
||||||
* @param context $context Request data from Telegram
|
* @param context $context Request data from Telegram
|
||||||
*
|
*
|
||||||
|
@ -875,12 +920,12 @@ final class registration extends core
|
||||||
// Initialized localization
|
// Initialized localization
|
||||||
|
|
||||||
// Reading from the telegram user buffer
|
// Reading from the telegram user buffer
|
||||||
$context->getUserDataItem('distribution_registration')
|
$context->getUserDataItem(static::PROCESS)
|
||||||
->then(function ($distribution) use ($context, $account, $localization) {
|
->then(function (?array $distribution) use ($context, $account, $localization) {
|
||||||
// Readed from the telegram user buffer
|
// Readed from the telegram user buffer
|
||||||
|
|
||||||
if ($distribution) {
|
if ($distribution) {
|
||||||
// Found started registration process
|
// Found started declaration process
|
||||||
|
|
||||||
// Initializing the new location
|
// Initializing the new location
|
||||||
preg_match_all('/(\-?\d{1,2})\.?(\d*)/', $context->getMessage()->getText(), $matches);
|
preg_match_all('/(\-?\d{1,2})\.?(\d*)/', $context->getMessage()->getText(), $matches);
|
||||||
|
@ -913,12 +958,12 @@ final class registration extends core
|
||||||
// Initializing the old location
|
// Initializing the old location
|
||||||
$old = str_replace('.', '\\.', (empty($distribution['latitude']) ? '_' . $localization['empty'] . '_' : $distribution['latitude']) . ', ' . (empty($distribution['longitude']) ? '_' . $localization['empty'] . '_' : $distribution['longitude']));
|
$old = str_replace('.', '\\.', (empty($distribution['latitude']) ? '_' . $localization['empty'] . '_' : $distribution['latitude']) . ', ' . (empty($distribution['longitude']) ? '_' . $localization['empty'] . '_' : $distribution['longitude']));
|
||||||
|
|
||||||
// Writing into the distribution registration process buffer
|
// Writing into the distribution declaration process buffer
|
||||||
$distribution['latitude'] = $latitude;
|
$distribution['latitude'] = $latitude;
|
||||||
$distribution['longitude'] = $longitude;
|
$distribution['longitude'] = $longitude;
|
||||||
|
|
||||||
// Writing to the telegram user buffer
|
// Writing to the telegram user buffer
|
||||||
$context->setUserDataItem('distribution_registration', $distribution)
|
$context->setUserDataItem(static::PROCESS, $distribution)
|
||||||
->then(function () use ($context, $account, $localization, $latitude, $longitude, $old) {
|
->then(function () use ($context, $account, $localization, $latitude, $longitude, $old) {
|
||||||
// Writed to the telegram user buffer
|
// Writed to the telegram user buffer
|
||||||
|
|
||||||
|
@ -926,19 +971,19 @@ final class registration extends core
|
||||||
$new = str_replace('.', '\\.', $latitude . ', ' . $longitude);
|
$new = str_replace('.', '\\.', $latitude . ', ' . $longitude);
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('✅ *' . $localization['distribution_registration_location_update_success'] . "*\n$old → *$new*")
|
$context->sendMessage('✅ *' . $localization[static::PROCESS . '_location_update_success'] . "*\n$old → *$new*")
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
// Sending the generation menu
|
// Sending the distribution declaration menu
|
||||||
static::generation($context);
|
static::menu($context);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (error $error) {
|
} catch (error $error) {
|
||||||
// Failed to send the message about name update
|
// Failed to send the message about name update
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('❎ *' . $localization['distribution_registration_name_update_fail'])
|
$context->sendMessage('❎ *' . $localization[static::PROCESS . '_name_update_fail'])
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
|
@ -948,7 +993,7 @@ final class registration extends core
|
||||||
// Not passed longitude maximum value check
|
// Not passed longitude maximum value check
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_location_send_longitude_too_big'] . '*')
|
$context->sendMessage('⚠️ *' . $localization[static::PROCESS . '_location_send_longitude_too_big'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
|
@ -956,14 +1001,14 @@ final class registration extends core
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
|
|
||||||
// Requesting to enter locaztion again
|
// Requesting to enter locaztion again
|
||||||
button_distribution_registration::location($context);
|
button_distribution_declaration::location($context);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not passed longitude minimum value check
|
// Not passed longitude minimum value check
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_location_send_longitude_too_small'] . '*')
|
$context->sendMessage('⚠️ *' . $localization[static::PROCESS . '_location_send_longitude_too_small'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
|
@ -971,14 +1016,14 @@ final class registration extends core
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
|
|
||||||
// Requesting to enter locaztion again
|
// Requesting to enter locaztion again
|
||||||
button_distribution_registration::location($context);
|
button_distribution_declaration::location($context);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not passed latitude maximum value check
|
// Not passed latitude maximum value check
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_location_send_latitude_too_big'] . '*')
|
$context->sendMessage('⚠️ *' . $localization[static::PROCESS . '_location_send_latitude_too_big'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
|
@ -986,14 +1031,14 @@ final class registration extends core
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
|
|
||||||
// Requesting to enter locaztion again
|
// Requesting to enter locaztion again
|
||||||
button_distribution_registration::location($context);
|
button_distribution_declaration::location($context);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not passed latitude minimum value check
|
// Not passed latitude minimum value check
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_location_send_latitude_too_small'] . '*')
|
$context->sendMessage('⚠️ *' . $localization[static::PROCESS . '_location_send_latitude_too_small'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
|
@ -1001,14 +1046,14 @@ final class registration extends core
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
|
|
||||||
// Requesting to enter locaztion again
|
// Requesting to enter locaztion again
|
||||||
button_distribution_registration::location($context);
|
button_distribution_declaration::location($context);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Failed to initialize the new name
|
// Failed to initialize the new name
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('📄 *' . $localization['distribution_registration_location_send_not_acceptable'] . '*')
|
$context->sendMessage('📄 *' . $localization[static::PROCESS . '_location_send_not_acceptable'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
|
@ -1016,14 +1061,14 @@ final class registration extends core
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
|
|
||||||
// Requesting to send location again
|
// Requesting to send location again
|
||||||
button_distribution_registration::location($context);
|
button_distribution_declaration::location($context);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not initialized the new location
|
// Not initialized the new location
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('📄 *' . $localization['distribution_registration_location_send_not_acceptable'] . '*')
|
$context->sendMessage('📄 *' . $localization[static::PROCESS . '_location_send_not_acceptable'] . '*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
// Sended the message
|
// Sended the message
|
||||||
|
|
||||||
|
@ -1031,14 +1076,23 @@ final class registration extends core
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
|
|
||||||
// Requesting to send locaztion again
|
// Requesting to send locaztion again
|
||||||
button_distribution_registration::location($context);
|
button_distribution_declaration::location($context);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not found started registretion process
|
// Not found started distribution declaratoin process
|
||||||
|
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *' . $localization['distribution_registration_not_started'] . '*');
|
$context->sendMessage('⚠️ *' . $localization[static::PROCESS . '_not_started'] . '*')
|
||||||
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
|
// Ending the conversation process
|
||||||
|
$context->endConversation();
|
||||||
|
|
||||||
|
// Sending the distributions menu
|
||||||
|
commands::distributions($context);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace svoboda\svoboder\models\telegram;
|
namespace svoboda\svoboder\models\telegram\processes\language;
|
||||||
|
|
||||||
// Files of the project
|
// Files of the project
|
||||||
use svoboda\svoboder\models\core,
|
use svoboda\svoboder\models\core,
|
||||||
|
@ -16,28 +16,29 @@ use Zanzara\Context as context,
|
||||||
use mirzaev\baza\record;
|
use mirzaev\baza\record;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Telegram selections
|
* Telegram language select
|
||||||
*
|
*
|
||||||
* @package svoboda\svoboder\models\telegram
|
* @package svoboda\svoboder\models\telegram\processes\language
|
||||||
*
|
*
|
||||||
* @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 selections extends core
|
final class select extends core
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Language
|
* Language
|
||||||
*
|
*
|
||||||
* The language choose menu
|
* Send the language choose menu
|
||||||
*
|
*
|
||||||
* @param context $context Request data from Telegram
|
* @param context $context Request data from Telegram
|
||||||
* @param string $prefix Prefix for 'callback_data' (`$prefix . $language->name`)
|
* @param string $prefix Prefix for 'callback_data' (`$prefix . $language->name`)
|
||||||
* @param string $title Title of the message
|
* @param string $title Title of the message
|
||||||
* @param string $description Description of the message
|
* @param string $description Description of the message
|
||||||
|
* @param array $exclude Languages that will be excluded ['ru', 'en'...]
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function language(context $context, string $prefix, string $title, string $description): void
|
public static function menu(context $context, string $prefix, string $title, string $description, array $exclude = []): void
|
||||||
{
|
{
|
||||||
// Initializing the account
|
// Initializing the account
|
||||||
$account = $context->get('account');
|
$account = $context->get('account');
|
||||||
|
@ -75,6 +76,9 @@ final class selections extends core
|
||||||
foreach ($languages as $language) {
|
foreach ($languages as $language) {
|
||||||
// Iterating over languages
|
// Iterating over languages
|
||||||
|
|
||||||
|
// Skipping excluded languages
|
||||||
|
if (array_search($language->name, $exclude, strict: true) !== false) continue;
|
||||||
|
|
||||||
// Initializing the row
|
// Initializing the row
|
||||||
$keyboard[$row] ??= [];
|
$keyboard[$row] ??= [];
|
||||||
|
|
||||||
|
@ -89,7 +93,7 @@ final class selections extends core
|
||||||
}
|
}
|
||||||
|
|
||||||
// Writing the button for helping lozalizing
|
// Writing the button for helping lozalizing
|
||||||
$keyboard[++$row] = [
|
$keyboard[$row === 0 && empty($keyboard[0]) ? 0 : ++$row] = [
|
||||||
[
|
[
|
||||||
'text' => '🗂 ' . $localization['select_language_button_add'],
|
'text' => '🗂 ' . $localization['select_language_button_add'],
|
||||||
'url' => 'https://git.svoboda.works/svoboda/svoboder/src/branch/stable/svoboda/svoboder/system/localizations'
|
'url' => 'https://git.svoboda.works/svoboda/svoboder/src/branch/stable/svoboda/svoboder/system/localizations'
|
||||||
|
@ -112,6 +116,8 @@ final class selections extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
$context->sendMessage('⚠️ *Failed to initialize localization*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -122,6 +128,8 @@ final class selections extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize language*')
|
$context->sendMessage('⚠️ *Failed to initialize language*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
||||||
|
@ -132,6 +140,8 @@ final class selections extends core
|
||||||
// Sending the message
|
// Sending the message
|
||||||
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
$context->sendMessage('⚠️ *Failed to initialize your Telegram account*')
|
||||||
->then(function (message $message) use ($context) {
|
->then(function (message $message) use ($context) {
|
||||||
|
// Sended the message
|
||||||
|
|
||||||
// Ending the conversation process
|
// Ending the conversation process
|
||||||
$context->endConversation();
|
$context->endConversation();
|
||||||
});
|
});
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,66 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace svoboda\svoboder;
|
||||||
|
|
||||||
|
// Files of the project
|
||||||
|
use svoboda\svoboder\models\distribution,
|
||||||
|
svoboda\svoboder\models\localization\distribution as distribution_localization,
|
||||||
|
svoboda\svoboder\models\telegram\middlewares,
|
||||||
|
svoboda\svoboder\models\telegram\commands,
|
||||||
|
svoboda\svoboder\models\telegram\buttons,
|
||||||
|
svoboda\svoboder\models\telegram\selections,
|
||||||
|
svoboda\svoboder\models\telegram\settings,
|
||||||
|
svoboda\svoboder\models\enumerations\language,
|
||||||
|
svoboda\svoboder\models\telegram\processes\distribution\registration as process_distribution_registration,
|
||||||
|
svoboda\svoboder\models\telegram\processes\distribution\search as process_distribution_search,
|
||||||
|
svoboda\svoboder\models\telegram\buttons\distribution\registration as button_distribution_registration,
|
||||||
|
svoboda\svoboder\models\telegram\buttons\distribution\search as button_distribution_search,
|
||||||
|
svoboda\svoboder\models\telegram\buttons\distribution\administration as button_distribution_administration,
|
||||||
|
svoboda\svoboder\models\telegram\processes\distribution\localization as process_distribution_localization;
|
||||||
|
|
||||||
|
// Framework for PHP
|
||||||
|
use mirzaev\minimal\core,
|
||||||
|
mirzaev\minimal\route;
|
||||||
|
|
||||||
|
// 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 root directory
|
||||||
|
define('ROOT', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
|
// Initializing path to the settings directory
|
||||||
|
define('SETTINGS', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'settings');
|
||||||
|
|
||||||
|
// Initializing path to the storage directory
|
||||||
|
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 key
|
||||||
|
define('TELEGRAM_KEY', require(SETTINGS . DIRECTORY_SEPARATOR . 'telegram.php'));
|
||||||
|
|
||||||
|
// Initializing dependencies
|
||||||
|
require ROOT . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
// Initializing core
|
||||||
|
$$core = new core(namespace: __NAMESPACE__);
|
||||||
|
|
||||||
|
// Initializing routes
|
||||||
|
$$core->router
|
||||||
|
->write('/', new route('index', 'index'), 'GET')
|
||||||
|
->write('/map', new route('map', 'index'), 'GET')
|
||||||
|
;
|
||||||
|
|
||||||
|
// Handling request
|
||||||
|
$$core->start();
|
|
@ -10,13 +10,23 @@ use svoboda\svoboder\models\distribution,
|
||||||
svoboda\svoboder\models\telegram\middlewares,
|
svoboda\svoboder\models\telegram\middlewares,
|
||||||
svoboda\svoboder\models\telegram\commands,
|
svoboda\svoboder\models\telegram\commands,
|
||||||
svoboda\svoboder\models\telegram\buttons,
|
svoboda\svoboder\models\telegram\buttons,
|
||||||
svoboda\svoboder\models\telegram\selections,
|
svoboda\svoboder\models\telegram\account,
|
||||||
svoboda\svoboder\models\telegram\settings,
|
svoboda\svoboder\models\telegram\settings,
|
||||||
|
svoboda\svoboder\models\enumerations\member\status,
|
||||||
svoboda\svoboder\models\enumerations\language,
|
svoboda\svoboder\models\enumerations\language,
|
||||||
svoboda\svoboder\models\telegram\processes\distribution\registration as process_distribution_registration,
|
svoboda\svoboder\models\telegram\processes\member\search as process_member_search,
|
||||||
|
svoboda\svoboder\models\telegram\buttons\member\search as button_member_search,
|
||||||
|
svoboda\svoboder\models\telegram\processes\distribution\declaration as process_distribution_declaration,
|
||||||
svoboda\svoboder\models\telegram\processes\distribution\search as process_distribution_search,
|
svoboda\svoboder\models\telegram\processes\distribution\search as process_distribution_search,
|
||||||
svoboda\svoboder\models\telegram\buttons\distribution\registration as button_distribution_registration,
|
svoboda\svoboder\models\telegram\processes\distribution\select as process_distribution_select,
|
||||||
|
svoboda\svoboder\models\telegram\buttons\distribution\declaration as button_distribution_declaration,
|
||||||
svoboda\svoboder\models\telegram\buttons\distribution\search as button_distribution_search,
|
svoboda\svoboder\models\telegram\buttons\distribution\search as button_distribution_search,
|
||||||
|
svoboda\svoboder\models\telegram\buttons\distribution\select as button_distribution_select,
|
||||||
|
svoboda\svoboder\models\telegram\processes\account\localization\create as process_account_localization_create,
|
||||||
|
svoboda\svoboder\models\telegram\processes\account\localization\update as process_account_localization_update,
|
||||||
|
svoboda\svoboder\models\telegram\buttons\account\localization\create as button_account_localization_create,
|
||||||
|
svoboda\svoboder\models\telegram\buttons\account\localization\update as button_account_localization_update,
|
||||||
|
svoboda\svoboder\models\telegram\buttons\distribution\administration as button_distribution_administration,
|
||||||
svoboda\svoboder\models\telegram\processes\distribution\localization as process_distribution_localization;
|
svoboda\svoboder\models\telegram\processes\distribution\localization as process_distribution_localization;
|
||||||
|
|
||||||
// Framework for Telegram
|
// Framework for Telegram
|
||||||
|
@ -24,9 +34,6 @@ use Zanzara\Zanzara as zanzara,
|
||||||
Zanzara\Context as context,
|
Zanzara\Context as context,
|
||||||
Zanzara\Config as config;
|
Zanzara\Config as config;
|
||||||
|
|
||||||
// Baza database
|
|
||||||
use mirzaev\baza\record;
|
|
||||||
|
|
||||||
// Enabling debugging
|
// Enabling debugging
|
||||||
/* ini_set('error_reporting', E_ALL);
|
/* ini_set('error_reporting', E_ALL);
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
|
@ -56,6 +63,9 @@ define('TELEGRAM_KEY', require(SETTINGS . DIRECTORY_SEPARATOR . 'telegram.php'))
|
||||||
// Initializing dependencies
|
// Initializing dependencies
|
||||||
require ROOT . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
|
require ROOT . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
|
|
||||||
|
// Initializing system settings
|
||||||
|
require SETTINGS . DIRECTORY_SEPARATOR . 'system.php';
|
||||||
|
|
||||||
// Initializing the configuration
|
// Initializing the configuration
|
||||||
$config = new config();
|
$config = new config();
|
||||||
$config->setParseMode(config::PARSE_MODE_MARKDOWN);
|
$config->setParseMode(config::PARSE_MODE_MARKDOWN);
|
||||||
|
@ -76,59 +86,54 @@ $robot->middleware([middlewares::class, 'system']);
|
||||||
// Initializing the robot commands handlers
|
// Initializing the robot commands handlers
|
||||||
$robot->onCommand('start', [commands::class, 'menu']);
|
$robot->onCommand('start', [commands::class, 'menu']);
|
||||||
$robot->onCommand('menu', [commands::class, 'menu']);
|
$robot->onCommand('menu', [commands::class, 'menu']);
|
||||||
|
$robot->onCommand('members', [commands::class, 'members']);
|
||||||
|
$robot->onCommand('account', [commands::class, 'account']);
|
||||||
|
$robot->onCommand('distributions', [commands::class, 'distributions']);
|
||||||
/* $robot->onCommand('request', [telegram::class, 'request_start'])->middleware([telegram::class, 'request']); */
|
/* $robot->onCommand('request', [telegram::class, 'request_start'])->middleware([telegram::class, 'request']); */
|
||||||
/* $robot->onCommand('svoboda', [commands::class, 'svoboda']);
|
/* $robot->onCommand('svoboda', [commands::class, 'svoboda']);
|
||||||
$robot->onCommand('members', [commands::class, 'members']); */
|
$robot->onCommand('members', [commands::class, 'members']); */
|
||||||
$robot->onCommand('language', [commands::class, 'language'])->middleware([middlewares::class, 'settings']);
|
$robot->onCommand('language', [commands::class, 'language'])->middleware([middlewares::class, 'settings']);
|
||||||
$robot->onCommand('society', [commands::class, 'society']);
|
|
||||||
$robot->onCommand('repository', [commands::class, 'repository']);
|
$robot->onCommand('repository', [commands::class, 'repository']);
|
||||||
/* $robot->onCommand('projects', [commands::class, 'projects']); */
|
/* $robot->onCommand('projects', [commands::class, 'projects']); */
|
||||||
$robot->onCommand('author', [commands::class, 'author']);
|
$robot->onCommand('author', [commands::class, 'author']);
|
||||||
|
$robot->onCommand('society', [commands::class, 'society']);
|
||||||
|
/* $robot->onCommand('system_settings', [commands::class, 'system_settings'])->middleware([middlewares::class, 'system_settings']); */
|
||||||
|
|
||||||
// Initializing the robot distrubitions menu handlers
|
// Initializing the robot buttons handlers
|
||||||
$robot->onCommand('distributions', [commands::class, 'distributions']);
|
|
||||||
$robot->onCbQueryData(['distributions'], [commands::class, 'distributions']); // Remake to buttons?
|
$robot->onCbQueryData(['distributions'], [commands::class, 'distributions']); // Remake to buttons?
|
||||||
|
|
||||||
// Initializing the robot distributions search button handlers
|
|
||||||
$robot->onCbQueryData(['distribution_search_start'], [process_distribution_search::class, 'start']);
|
$robot->onCbQueryData(['distribution_search_start'], [process_distribution_search::class, 'start']);
|
||||||
$robot->onCbQueryData(['distribution_search_text'], [button_distribution_search::class, 'text']);
|
$robot->onCbQueryData(['distribution_search_name'], [button_distribution_search::class, 'name']);
|
||||||
/* $robot->onCbQueryData(['distribution_search_next'], [process_distribution_search::class, 'text']); */
|
/* $robot->onCbQueryData(['distribution_search_next'], [process_distribution_search::class, 'text']); */
|
||||||
$robot->onCbQueryData(['distribution_search_end'], [process_distribution_search::class, 'end']);
|
$robot->onCbQueryData(['distribution_search_end'], [process_distribution_search::class, 'end']);
|
||||||
$robot->onCbQueryData(['distribution_search_confirmed'], [process_distribution_search::class, 'confirmed']);
|
|
||||||
$robot->onCbQueryData(['distribution_search_location'], [button_distribution_search::class, 'location']);
|
$robot->onCbQueryData(['distribution_search_location'], [button_distribution_search::class, 'location']);
|
||||||
$robot->onCbQueryData(['distribution_search_distance'], [button_distribution_search::class, 'distance']);
|
$robot->onCbQueryData(['distribution_search_distance'], [button_distribution_search::class, 'distance']);
|
||||||
|
$robot->onCbQueryData(['distribution_search_plan'], [button_distribution_search::class, 'plan'])->middleware([middlewares::class, 'join']);
|
||||||
// Initializing the robot distribution search location send button handler
|
$robot->onCbQueryData(['distribution_search_unplan'], [button_distribution_search::class, 'unplan'])->middleware([middlewares::class, 'join']);
|
||||||
|
$robot->onCbQueryData(['distribution_search_join'], [button_distribution_search::class, 'join'])->middleware([middlewares::class, 'join']);
|
||||||
|
$robot->onCbQueryData(['distribution_search_leave'], [button_distribution_search::class, 'leave'])->middleware([middlewares::class, 'join']);
|
||||||
$robot->onCbQueryData(['distribution_search_location'], [button_distribution_search::class, 'location']);
|
$robot->onCbQueryData(['distribution_search_location'], [button_distribution_search::class, 'location']);
|
||||||
|
$robot->onCbQueryData(['distribution_search_members'], [process_member_search::class, 'start']);
|
||||||
|
|
||||||
// Initializing the robot distributions registration buttons handlers
|
$robot->onCbQueryData(['distribution_select_name'], [button_distribution_select::class, 'name']);
|
||||||
$robot->onCbQueryData(['distribution_registration_start'], [process_distribution_registration::class, 'start']);
|
$robot->onCbQueryData(['distribution_select_location'], [button_distribution_select::class, 'location']);
|
||||||
$robot->onCbQueryData(['distribution_registration_cancel'], [process_distribution_registration::class, 'cancel']);
|
$robot->onCbQueryData(['distribution_select_distance'], [button_distribution_select::class, 'distance']);
|
||||||
$robot->onCbQueryData(['distribution_registration_end'], [process_distribution_registration::class, 'end']);
|
/* $robot->onCbQueryData(['distribution_select_next'], [process_distribution_select::class, 'next']); */
|
||||||
|
$robot->onCbQueryData(['distribution_select_select'], [process_distribution_select::class, 'select']);
|
||||||
|
$robot->onCbQueryData(['distribution_select_delete'], [process_distribution_select::class, 'delete']);
|
||||||
|
$robot->onCbQueryData(['distribution_select_cancel'], [process_distribution_select::class, 'cancel']);
|
||||||
|
|
||||||
// Initializing the robot distribution localization language select button handler
|
$robot->onCbQueryData(['distribution_declaration_start'], [process_distribution_declaration::class, 'start']);
|
||||||
$robot->onCbQueryData(['distribution_registration_language'], [button_distribution_registration::class, 'language']);
|
$robot->onCbQueryData(['distribution_declaration_cancel'], [process_distribution_declaration::class, 'cancel']);
|
||||||
|
$robot->onCbQueryData(['distribution_declaration_end'], [process_distribution_declaration::class, 'end']);
|
||||||
// Initializing the robot distribution registration language buttons handlers
|
$robot->onCbQueryData(['distribution_declaration_language'], [button_distribution_declaration::class, 'language']);
|
||||||
foreach (language::cases() as $language) {
|
foreach (language::cases() as $language)
|
||||||
// Iterating over languages
|
$robot->onCbQueryData(['distribution_declaration_select_language_' . $language->name], fn(context $context) => process_distribution_declaration::language($context, $language));
|
||||||
|
$robot->onCbQueryData(['distribution_declaration_name'], [button_distribution_declaration::class, 'name']);
|
||||||
// Initializing language buttons
|
$robot->onCbQueryData(['distribution_declaration_location'], [button_distribution_declaration::class, 'location']);
|
||||||
$robot->onCbQueryData(['distribution_registration_select_language_' . $language->name], fn(context $context) => process_distribution_registration::language($context, $language));
|
/* $robot->onCbQueryData(['distribution_accept_toggle'], [button_distribution_administration::class, 'accept'])->middleware([middlewares::class, 'distributions_administration']); */
|
||||||
};
|
|
||||||
|
|
||||||
// Initializing the robot distribution registration localization name enter button handler
|
|
||||||
$robot->onCbQueryData(['distribution_registration_name'], [button_distribution_registration::class, 'name']);
|
|
||||||
|
|
||||||
// Initializing the robot distribution registration location send button handler
|
|
||||||
$robot->onCbQueryData(['distribution_registration_location'], [button_distribution_registration::class, 'location']);
|
|
||||||
|
|
||||||
|
|
||||||
// Initializing the robot distributions localization buttons handlers
|
|
||||||
/* $robot->onCbQueryData(['distribution_localization_start'], [process_distribution_localization::class, 'start']); */
|
/* $robot->onCbQueryData(['distribution_localization_start'], [process_distribution_localization::class, 'start']); */
|
||||||
/* $robot->onCbQueryData(['distribution_localization_language'], [distribution_localization::class, 'language']);
|
/* $robot->onCbQueryData(['distribution_localization_language'], [distribution_localization::class, 'language']);
|
||||||
$robot->onCbQueryData(['distribution_localization_name'], [distribution_localization::class, 'name']); */
|
$robot->onCbQueryData(['distribution_localization_name'], [distribution_localization::class, 'name']); */
|
||||||
|
|
||||||
/* // Initializing the robot distribution localization language select button handler
|
/* // Initializing the robot distribution localization language select button handler
|
||||||
$robot->onCbQueryData(
|
$robot->onCbQueryData(
|
||||||
['distribution_localization_language'],
|
['distribution_localization_language'],
|
||||||
|
@ -152,6 +157,30 @@ foreach (language::cases() as $language) {
|
||||||
// Initializing the robot distributions menu buttons handlers
|
// Initializing the robot distributions menu buttons handlers
|
||||||
/* $robot->onCbQueryData(['distributions_search_start'], [process_distribution_search::class, 'start']); */
|
/* $robot->onCbQueryData(['distributions_search_start'], [process_distribution_search::class, 'start']); */
|
||||||
|
|
||||||
|
$robot->onCbQueryData(['members'], [commands::class, 'members']); // Remake to buttons?
|
||||||
|
$robot->onCbQueryData(['member_search_start'], [process_member_search::class, 'start']);
|
||||||
|
$robot->onCbQueryData(['member_search_name'], [button_member_search::class, 'name']);
|
||||||
|
$robot->onCbQueryData(['member_search_distribution'], [button_member_search::class, 'distribution']);
|
||||||
|
foreach (status::cases() as $status)
|
||||||
|
$robot->onCbQueryData(['member_search_status_' . $status->name], fn(context $context) => process_member_search::status($context, $status));
|
||||||
|
$robot->onCbQueryData(['member_search_status'], [button_member_search::class, 'status']);
|
||||||
|
$robot->onCbQueryData(['member_search_end'], [process_member_search::class, 'end']);
|
||||||
|
|
||||||
|
$robot->onCbQueryData(['account_localizations'], [account::class, 'localizations']);
|
||||||
|
$robot->onCbQueryData(['account_localization_create_start'], [process_account_localization_create::class, 'start']);
|
||||||
|
$robot->onCbQueryData(['account_localization_create_cancel'], [process_account_localization_create::class, 'cancel']);
|
||||||
|
$robot->onCbQueryData(['account_localization_create_end'], [process_account_localization_create::class, 'end']);
|
||||||
|
$robot->onCbQueryData(['account_localization_create_language'], [button_account_localization_create::class, 'language']);
|
||||||
|
$robot->onCbQueryData(['account_localization_update_cancel'], [process_account_localization_update::class, 'cancel']);
|
||||||
|
$robot->onCbQueryData(['account_localization_update_end'], [process_account_localization_update::class, 'end']);
|
||||||
|
foreach (language::cases() as $language) {
|
||||||
|
$robot->onCbQueryData(['account_localization_create_select_language_' . $language->name], fn(context $context) => process_account_localization_create::language($context, $language));
|
||||||
|
$robot->onCbQueryData(['account_localization_update_' . $language->name], fn(context $context) => process_account_localization_update::start($context, $language));
|
||||||
|
}
|
||||||
|
$robot->onCbQueryData(['account_localization_create_name'], [button_account_localization_create::class, 'name']);
|
||||||
|
$robot->onCbQueryData(['account_localization_update_name'], [button_account_localization_update::class, 'name']);
|
||||||
|
/* $robot->onCbQueryData(['account_localizations_search'], [process_account_localization_search::class, 'start']); */
|
||||||
|
|
||||||
// Initializing the robot settings language buttons handlers
|
// Initializing the robot settings language buttons handlers
|
||||||
foreach (language::cases() as $language) {
|
foreach (language::cases() as $language) {
|
||||||
// Iterating over languages
|
// Iterating over languages
|
||||||
|
@ -160,8 +189,5 @@ foreach (language::cases() as $language) {
|
||||||
$robot->onCbQueryData(['settings_language_' . $language->name], fn(context $context) => settings::language($context, $language));
|
$robot->onCbQueryData(['settings_language_' . $language->name], fn(context $context) => settings::language($context, $language));
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initializing the robot protected commands handlers
|
|
||||||
/* $robot->onCommand('system_settings', [commands::class, 'system_settings'])->middleware([middlewares::class, 'system_settings']); */
|
|
||||||
|
|
||||||
// Starting chat-robot
|
// Starting chat-robot
|
||||||
$robot->run();
|
$robot->run();
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
*
|
*
|
||||||
|
!system.php
|
||||||
!.gitignore
|
!.gitignore
|
||||||
!*.sample
|
!*.sample
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
define('MENU_MEMBERS_AMOUNT', 10000000);
|
||||||
|
|
||||||
|
define('DISTRIBUTIONS_SEARCH_PAGE', 3);
|
||||||
|
define('DISTRIBUTIONS_SEARCH_DISTRIBUTION_DISTANCE', 300);
|
||||||
|
define('DISTRIBUTIONS_SEARCH_DISTRIBUTION_LOCALIZATIONS_AMOUNT', 100);
|
||||||
|
define('DISTRIBUTIONS_SEARCH_DISTRIBUTION_NAME_LEVENSHTEIN_DISTANCE', 4);
|
||||||
|
define('DISTRIBUTIONS_SEARCH_MEMBER_DEPRECATING_RECORDS_AMOUNT', 500);
|
||||||
|
define('DISTRIBUTIONS_SEARCH_MEMBERS_AMOUNT', 10000000);
|
||||||
|
|
||||||
|
define('DISTRIBUTIONS_SELECT_PAGE', 10);
|
||||||
|
define('DISTRIBUTIONS_SELECT_DISTRIBUTION_DISTANCE', 300);
|
||||||
|
define('DISTRIBUTIONS_SELECT_DISTRIBUTION_LOCALIZATIONS_AMOUNT', 100);
|
||||||
|
define('DISTRIBUTIONS_SELECT_DISTRIBUTION_NAME_LEVENSHTEIN_DISTANCE', 4);
|
||||||
|
define('DISTRIBUTIONS_SELECT_MEMBER_DEPRECATING_RECORDS_AMOUNT', 500);
|
||||||
|
define('DISTRIBUTIONS_SELECT_MEMBERS_AMOUNT', 10000000);
|
||||||
|
|
||||||
|
define('MEMBERS_SEARCH_PAGE', 3);
|
||||||
|
define('MEMBERS_SEARCH_DISTRIBUTION_LOCALIZATIONS_AMOUNT', 100);
|
||||||
|
define('MEMBERS_SEARCH_ACCOUNT_LOCALIZATIONS_AMOUNT', 100);
|
||||||
|
define('MEMBERS_SEARCH_MEMBER_NAME_LEVENSHTEIN_DISTANCE', 4);
|
||||||
|
define('MEMBERS_SEARCH_STATUS_ROW_AMOUNT', 3);
|
||||||
|
|
||||||
|
define('ACCOUNT_LOCALIZATION_ACCOUNT_LOCALIZATIONS_AMOUNT', 100);
|
||||||
|
define('ACCOUNT_LOCALIZATION_CREATE_ACCOUNT_LOCALIZATIONS_AMOUNT', 100);
|
Loading…
Reference in New Issue