Skip to content
This repository was archived by the owner on Mar 30, 2024. It is now read-only.

Commit b73c7bb

Browse files
committed
Readline Telegram-Bot Optim.
1 parent 29b4dc3 commit b73c7bb

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

core/CLIOutput.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class CLIOutput {
2020
const ERROR_FATAL = 3;
2121

2222
private static int $readlineCount = 0;
23+
private static array $readlineUsed = array();
2324

2425
public static function colorString(string $s, string $color) : string {
2526
return $color . $s . self::RESET;
@@ -131,6 +132,15 @@ public function readline(string $question, ?string $color = null, int $ind = 0)
131132
$r = Config::getStorageReader('telegram');
132133
if($r->isValue(['readline', $question])){
133134
$val = $r->getValue(['readline', $question]);
135+
if(is_array($val)){
136+
if(!isset( self::$readlineUsed[$question] ) ){
137+
self::$readlineUsed[$question] = 0;
138+
}
139+
if(isset($val[self::$readlineUsed[$question]])){
140+
$val = self::$readlineUsed[$question];
141+
}
142+
self::$readlineUsed[$question]++;
143+
}
134144
return !is_string($val) ? "" : $val;
135145
}
136146
else{

core/Utilities.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
class Utilities {
66

7-
const VERSION = 'v1.0.8';
7+
const VERSION = 'v1.0.9';
88

99
const DEFAULT_LINE_LENGTH = 125;
1010

0 commit comments

Comments
 (0)