Skip to content

Commit 5aa3c6f

Browse files
Refactor: Remove internal persistence and add Redis helper
- Removed MySQL-based internal data persistence (DB, Conversation, ConversationDB). - Made the library stateless by removing all internal storage logic. - Updated Telegram.php version to 1.0.4. - Added a Redis helper (enableRedis, getRedis) using predis/predis for optional shared Redis client access in commands.
1 parent fc28e3e commit 5aa3c6f

File tree

6 files changed

+47
-822
lines changed

6 files changed

+47
-822
lines changed

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@
4040
"ext-curl": "*",
4141
"ext-json": "*",
4242
"ext-mbstring": "*",
43-
"psr/log": "^1.1|^2.0|^3.0",
44-
"guzzlehttp/guzzle": "^6.0|^7.0"
43+
"guzzlehttp/guzzle": "^6.0|^7.0",
44+
"predis/predis": "^2.0",
45+
"psr/log": "^1.1|^2.0|^3.0"
4546
},
4647
"require-dev": {
4748
"phpunit/phpunit": "^9.5",

src/Commands/SystemCommands/GenericmessageCommand.php

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,12 @@ class GenericmessageCommand extends SystemCommand
3535
/**
3636
* @var string
3737
*/
38-
protected $version = '1.2.0';
38+
protected $version = '1.2.1'; // Updated version
3939

4040
/**
4141
* @var bool
4242
*/
43-
protected $need_mysql = true;
44-
45-
/**
46-
* Execution if MySQL is required but not available
47-
*
48-
* @return ServerResponse
49-
* @throws TelegramException
50-
*/
51-
public function executeNoDb(): ServerResponse
52-
{
53-
// Try to execute any deprecated system commands.
54-
if (self::$execute_deprecated && $deprecated_system_command_response = $this->executeDeprecatedSystemCommand()) {
55-
return $deprecated_system_command_response;
56-
}
57-
58-
return Request::emptyResponse();
59-
}
43+
protected $need_mysql = false; // MySQL is no longer used
6044

6145
/**
6246
* Execute command
@@ -66,11 +50,7 @@ public function executeNoDb(): ServerResponse
6650
*/
6751
public function execute(): ServerResponse
6852
{
69-
// Try to continue any active conversation.
70-
if ($active_conversation_response = $this->executeActiveConversation()) {
71-
return $active_conversation_response;
72-
}
73-
53+
// Conversation logic removed.
7454
// Try to execute any deprecated system commands.
7555
if (self::$execute_deprecated && $deprecated_system_command_response = $this->executeDeprecatedSystemCommand()) {
7656
return $deprecated_system_command_response;

src/Conversation.php

Lines changed: 0 additions & 216 deletions
This file was deleted.

src/ConversationDB.php

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)