Skip to content

Commit

Permalink
Merge pull request #362 from mmagi/feat_bot
Browse files Browse the repository at this point in the history
fix: robot mute rule has no effect
  • Loading branch information
ZhouYixun authored Jun 6, 2023
2 parents 8492cf1 + 83e7712 commit a3941c0
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 a3941c0

Please sign in to comment.