涩图模块:匹配正则

This commit is contained in:
Yutousama 2022-04-17 21:41:54 +08:00
parent 1b593106ab
commit fdc1d7c880

View File

@ -65,6 +65,7 @@ public class GetSeTu extends Model {
}
String ret = HttpTools.get(url);
JSONObject json = JSONObject.parseObject(ret);
System.out.println("涩图反馈 = " + json);
if (json.getJSONArray("data").size() == 0) {
QQBotManager.getInstance().sendMessage(qq, "找不到喵~");
return;
@ -104,6 +105,13 @@ public class GetSeTu extends Model {
}
public static void main(String[] args) {
String msg="来点1色图";
Pattern pattern = Pattern.compile("来点(.*?)色图");
Matcher matcher=pattern.matcher(msg);
String key=null;
if(matcher.find()){
key=matcher.group(1);
}
System.out.println("key = " + key);
}
}