Skip to content

Commit

Permalink
fix: robot mute rule has no effect
Browse files Browse the repository at this point in the history
  • Loading branch information
mmagi committed Jun 6, 2023
1 parent 8492cf1 commit 83e7712
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void sendErrorDevice(int agentId, int errorType, int tem, String udId) {
private void send(List<AlertRobots> robots, Message message) {
for (var robot : robots) {
try {
var messenger = robotFactory.getRobotMessenger(robot.getRobotType(), robot.getMuteRule());
var messenger = robotFactory.getRobotMessenger(robot.getRobotType(), robot.getMuteRule(), message);
if (messenger == null) continue;
var template = robot.getTemplate();
messenger.sendMessage(restTemplate, robot.getRobotToken(), robot.getRobotSecret(), template, message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public RobotMessenger getRobotMessenger(int robotType) {
return robotMessenger;
}

public RobotMessenger getRobotMessenger(int robotType, String muteRule) {
public RobotMessenger getRobotMessenger(int robotType, String muteRule, Message message) {
if (!muteRule.isEmpty()) {
var mute = RobotMessenger.parseTemplate(muteRule).getValue(RobotMessenger.ctx, String.class);
var mute = RobotMessenger.parseTemplate(muteRule).getValue(RobotMessenger.ctx, message, String.class);
if ("true".equals(mute)) {
return null;
}
Expand Down

0 comments on commit 83e7712

Please sign in to comment.