summaryrefslogtreecommitdiff
path: root/src/NeonXP/BotScript.php
diff options
context:
space:
mode:
authorAlexander NeonXP Kiryukhin <frei@neonxp.info>2016-05-27 16:14:42 +0300
committerAlexander NeonXP Kiryukhin <frei@neonxp.info>2016-05-27 16:14:42 +0300
commite419c1c0f4cc29029ccf6aeb466575966618d8e0 (patch)
tree84cb5dc654e91e749222c19573963c956c55ecc5 /src/NeonXP/BotScript.php
parentb0ce9633e6f33fd0b68ac3c2104447ec729d7369 (diff)
Added DB search 3
Diffstat (limited to 'src/NeonXP/BotScript.php')
-rw-r--r--src/NeonXP/BotScript.php11
1 files changed, 6 insertions, 5 deletions
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