From e419c1c0f4cc29029ccf6aeb466575966618d8e0 Mon Sep 17 00:00:00 2001 From: Alexander NeonXP Kiryukhin Date: Fri, 27 May 2016 16:14:42 +0300 Subject: Added DB search 3 --- src/NeonXP/BotScript.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/NeonXP') diff --git a/src/NeonXP/BotScript.php b/src/NeonXP/BotScript.php index ac01681..0e7c6e0 100644 --- a/src/NeonXP/BotScript.php +++ b/src/NeonXP/BotScript.php @@ -83,34 +83,35 @@ class BotScript '33' => ['Я', 'А', ' ', ' ', ' ', ' ', '100001', '. - . -'], ]; $result = 'Непонятно :('; + $header = '*№* | _АлфЁ_ | *Алф* | _ОбрЁ_ | *Обр* | _Alp_ | *Rev* | _Двоич_ | Морзе'; if ($text == '$') { $result = ''; foreach ($db as $key => $value) { - $result .= sprintf('*%d* АлфЁ *%s* Алф *%s* ОбрЁ *%s* Обр *%s* Alph *%s* RvrsAlph *%s* Двоич *%s* Морз *%s*', + $result .= sprintf('*%d* | _%s_ | *%s* | _%s_ | *%s* | _%s_ | *%s* | _%s_ | *%s*', $key, $value[0],$value[1],$value[2],$value[3], $value[4],$value[5], $value[6],$value[7] ) . PHP_EOL; } } elseif (is_numeric($text) && (isset($db[$text]))) { - $result = sprintf('*%d* АлфЁ *%s* Алф *%s* ОбрЁ *%s* Обр *%s* Alph *%s* RvrsAlph *%s* Двоич *%s* Морз *%s*', + $result = sprintf('*%d* | _%s_ | *%s* | _%s_ | *%s* | _%s_ | *%s* | _%s_ | *%s*', $text, $db[$text][0],$db[$text][1],$db[$text][2],$db[$text][3], $db[$text][4],$db[$text][5], $db[$text][6],$db[$text][7] ); } else { foreach ($db as $key => $value) { if (mb_strtolower($value[0], 'utf8') == mb_strtolower($text)) { - $result = sprintf('*%d* АлфЁ *%s* Алф *%s* ОбрЁ *%s* Обр *%s* Alph *%s* RvrsAlph *%s* Двоич *%s* Морз *%s*', + $result = sprintf('*%d* | _%s_ | *%s* | _%s_ | *%s* | _%s_ | *%s* | _%s_ | *%s*', $key, $value[0],$value[1],$value[2],$value[3], $value[4],$value[5], $value[6],$value[7] ); } if (strtolower($value[4]) == strtolower($text)) { - $result = sprintf('*%d* АлфЁ *%s* Алф *%s* ОбрЁ *%s* Обр *%s* Alph *%s* RvrsAlph *%s* Двоич *%s* Морз *%s*', + $result = sprintf('*%d* | _%s_ | *%s* | _%s_ | *%s* | _%s_ | *%s* | _%s_ | *%s*', $key, $value[0],$value[1],$value[2],$value[3], $value[4],$value[5], $value[6],$value[7] ); } } } if ($result) { - $telegram->getMethods()->sendMessage($message->getChat(), '```' . PHP_EOL . $result . PHP_EOL . '```', true); + $telegram->getMethods()->sendMessage($message->getChat(), $header . PHP_EOL . $result, true); } return State::INITIAL; //Set initial state -- cgit v1.2.3