mirror of
				https://github.com/ZSCNetSupportDept/WechatTicketSystem.git
				synced 2025-11-01 02:46:19 +08:00 
			
		
		
		
	cortana test
This commit is contained in:
		| @@ -1,5 +1,6 @@ | ||||
| package love.sola.netsupport.config; | ||||
|  | ||||
| import lombok.Data; | ||||
| import org.yaml.snakeyaml.Yaml; | ||||
|  | ||||
| import java.io.InputStream; | ||||
| @@ -15,19 +16,27 @@ import java.util.regex.Pattern; | ||||
|  */ | ||||
| public class Cortana { | ||||
|  | ||||
|  | ||||
| 	public static List<Compiled> entries; | ||||
|  | ||||
| 	public static void load() { | ||||
| 		InputStream in = Lang.class.getClassLoader().getResourceAsStream("cortana.yml"); | ||||
| 		Map<String, Object> root = (Map<String, Object>) new Yaml().load(in); | ||||
|  | ||||
| 		RawConfig root = new Yaml().loadAs(in, RawConfig.class); | ||||
| 	} | ||||
|  | ||||
|  | ||||
| 	public static class Compiled { | ||||
| 	static class Compiled { | ||||
| 		Pattern[] patterns; | ||||
| 		String[] replies; | ||||
| 	} | ||||
|  | ||||
| 	@Data | ||||
| 	public static class Rule { | ||||
| 		String[] regexp; | ||||
| 		String[] replies; | ||||
| 	} | ||||
|  | ||||
| 	@Data | ||||
| 	public static class RawConfig { | ||||
| 		Map<String, Rule> rules; | ||||
| 	} | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sola
					Sola