|
|
@@ -129,7 +129,12 @@ post "/alert" => sub
|
|
|
my $message .= "$icon ` [" . ($alert->{labels}->{server}||"") . "] " . $alert->{labels}->{alertname} . " " .$alert->{labels}->{instance}
|
|
|
. " " . $alert->{labels}->{job} . "`\n";
|
|
|
$message .= $alert->{annotations}->{summary} . "\n" . "_" . $alert->{annotations}->{description} . "_";
|
|
|
- notify($channel, $message, {});
|
|
|
+
|
|
|
+ my $rest = {};
|
|
|
+
|
|
|
+ my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
|
|
+ $rest->{silent} = 1 if $hour < 9 || $hour > 23;
|
|
|
+ notify($channel, $message, $rest);
|
|
|
}
|
|
|
|
|
|
$c->render(text=>"ok");
|
|
|
@@ -234,9 +239,6 @@ sub command::start
|
|
|
notify($chatid, "$config->{title}.\nДля получения списка команд наберите */help*");
|
|
|
}
|
|
|
|
|
|
-#sub command::credit
|
|
|
-#sub command::balance
|
|
|
-
|
|
|
|
|
|
############################
|
|
|
|
|
|
@@ -322,6 +324,7 @@ sub notify
|
|
|
|
|
|
$params->{parse_mode} = "Markdown" unless $rest->{parse_mode} && $rest->{parse_mode} eq "none";
|
|
|
$params->{reply_to_message_id} = $rest->{msgid} if $rest->{msgid};
|
|
|
+ $params->{disable_notification} = 1 if $rest->{silent};
|
|
|
|
|
|
return request("sendMessage", $params)->catch(sub
|
|
|
{
|