mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-06-21 09:25:42 +02:00
telegram-chat: improve readability with symbols
This commit is contained in:
parent
6628d9f966
commit
cc81e55649
2 changed files with 10 additions and 6 deletions
|
@ -1361,6 +1361,7 @@
|
||||||
"earth"="\F0\9F\8C\8D";
|
"earth"="\F0\9F\8C\8D";
|
||||||
"fire"="\F0\9F\94\A5";
|
"fire"="\F0\9F\94\A5";
|
||||||
"floppy-disk"="\F0\9F\92\BE";
|
"floppy-disk"="\F0\9F\92\BE";
|
||||||
|
"gear"="\E2\9A\99";
|
||||||
"heart"="\E2\99\A5";
|
"heart"="\E2\99\A5";
|
||||||
"high-voltage-sign"="\E2\9A\A1";
|
"high-voltage-sign"="\E2\9A\A1";
|
||||||
"incoming-envelope"="\F0\9F\93\A8";
|
"incoming-envelope"="\F0\9F\93\A8";
|
||||||
|
|
|
@ -136,23 +136,26 @@
|
||||||
:execute script=(":do {\n" . $Message->"text" . "\n} on-error={ /file/add name=\"" . $File . ".failed\" };" . \
|
:execute script=(":do {\n" . $Message->"text" . "\n} on-error={ /file/add name=\"" . $File . ".failed\" };" . \
|
||||||
"/file/add name=\"" . $File . ".done\"") file=($File . "\00");
|
"/file/add name=\"" . $File . ".done\"") file=($File . "\00");
|
||||||
:if ([ $WaitForFile ($File . ".done") [ $EitherOr $TelegramChatRunTime 20s ] ] = false) do={
|
:if ([ $WaitForFile ($File . ".done") [ $EitherOr $TelegramChatRunTime 20s ] ] = false) do={
|
||||||
:set State "The command did not finish, still running in background.\n\n";
|
:set State ([ $SymbolForNotification "warning-sign" ] . "The command did not finish, still running in background.\n\n");
|
||||||
}
|
}
|
||||||
:if ([ :len [ /file/find where name=($File . ".failed") ] ] > 0) do={
|
:if ([ :len [ /file/find where name=($File . ".failed") ] ] > 0) do={
|
||||||
:set State "The command failed with an error!\n\n";
|
:set State ([ $SymbolForNotification "cross-mark" ] . "The command failed with an error!\n\n");
|
||||||
}
|
}
|
||||||
:local Content [ /file/get $File contents ];
|
:local Content [ /file/get $File contents ];
|
||||||
$SendTelegram2 ({ origin=$ScriptName; chatid=($Chat->"id"); silent=true; replyto=($Message->"message_id"); \
|
$SendTelegram2 ({ origin=$ScriptName; chatid=($Chat->"id"); silent=true; replyto=($Message->"message_id"); \
|
||||||
subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \
|
subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \
|
||||||
message=("Command:\n" . $Message->"text" . "\n\n" . $State . [ $IfThenElse ([ :len $Content ] > 0) \
|
message=([ $SymbolForNotification "gear" ] . "Command:\n" . $Message->"text" . "\n\n" . \
|
||||||
("Output:\n" . $Content) [ $IfThenElse ([ /file/get $File size ] > 0) \
|
$State . [ $IfThenElse ([ :len $Content ] > 0) \
|
||||||
("Output exceeds file read size.") ("No output.") ] ]) });
|
([ $SymbolForNotification "memo" ] . "Output:\n" . $Content) [ $IfThenElse ([ /file/get $File size ] > 0) \
|
||||||
|
([ $SymbolForNotification "warning-sign" ] . "Output exceeds file read size.") \
|
||||||
|
([ $SymbolForNotification "memo" ] . "No output.") ] ]) });
|
||||||
/file/remove "tmpfs/telegram-chat";
|
/file/remove "tmpfs/telegram-chat";
|
||||||
} else={
|
} else={
|
||||||
$LogPrint info $ScriptName ("The command from update " . $UpdateID . " failed syntax validation!");
|
$LogPrint info $ScriptName ("The command from update " . $UpdateID . " failed syntax validation!");
|
||||||
$SendTelegram2 ({ origin=$ScriptName; chatid=($Chat->"id"); silent=false; replyto=($Message->"message_id"); \
|
$SendTelegram2 ({ origin=$ScriptName; chatid=($Chat->"id"); silent=false; replyto=($Message->"message_id"); \
|
||||||
subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \
|
subject=([ $SymbolForNotification "speech-balloon" ] . "Telegram Chat"); \
|
||||||
message=("Command:\n" . $Message->"text" . "\n\nThe command failed syntax validation!") });
|
message=([ $SymbolForNotification "gear" ] . "Command:\n" . $Message->"text" . "\n\n" . \
|
||||||
|
[ $SymbolForNotification "cross-mark" ] . "The command failed syntax validation!") });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else={
|
} else={
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue