Merge pull request #11 from imyzt/develop

pref:lark bot support @user
pull/12/head
longtai 3 years ago committed by GitHub
commit d039aba3a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -24,7 +24,19 @@ public class LarkAlarmConstants {
public static final String NOTICE_JSON_PATH = "classpath:properties/lark/notice.json";
/**
* lark at format
* lark at format. openid
* openid,@
*/
public static final String LARK_AT_FORMAT = "<at email=''>%s</at>";
public static final String LARK_AT_FORMAT_OPENID = "<at id='%s'></at>";
/**
* lark at format. username
* username,@username,@@
*/
public static final String LARK_AT_FORMAT_USERNAME = "<at id=''>%s</at>";
/**
* lark openid prefix
*/
public static final String LARK_OPENID_PREFIX = "ou_";
}

@ -170,7 +170,8 @@ public class LarkSendMessageHandler implements SendMessageHandler {
return "";
}
return Arrays.stream(notifyConfig.getReceives().split(","))
.map(receive -> String.format(LARK_AT_FORMAT, receive))
.map(receive -> StrUtil.startWith(receive, LARK_OPENID_PREFIX) ?
String.format(LARK_AT_FORMAT_OPENID, receive) : String.format(LARK_AT_FORMAT_USERNAME, receive))
.collect(Collectors.joining(" "));
}

@ -153,8 +153,8 @@
{
"is_short": true,
"text": {
"user_id": "** OWNER** %s",
"tag": "at"
"content": "** OWNER** %s",
"tag": "lark_md"
}
},
{

Loading…
Cancel
Save