@@ -46,7 +46,17 @@ public static String command(long userID, String typeCommandName)
4646 lastUse (userID );
4747 StringBuilder builder = new StringBuilder ();
4848 builder .append (file .getString (typeCommandName + ".begin" )); //開頭
49- JSONArray dotListArray = file .getJSONArray (typeCommandName + ".list" );
49+
50+ String jsonKey = typeCommandName + ".list" ;
51+ JSONObject hasKeyFile ;
52+ if (file .has (jsonKey )) //如果有這個key
53+ hasKeyFile = file ;
54+ else if (englishFile .has (jsonKey )) //預設使用英文
55+ hasKeyFile = englishFile ;
56+ else
57+ return file .getString (typeCommandName + ".fail" );
58+
59+ JSONArray dotListArray = hasKeyFile .getJSONArray (jsonKey );
5060 int dotListArrayLength = dotListArray .length ();
5161 for (int i = 0 ; i < dotListArrayLength ; i ++) //所有.list內的內容
5262 builder .append (dotListArray .getString (i )).append (' ' );
@@ -57,11 +67,11 @@ public static String command(long userID, String typeCommandName)
5767 public static String command (long userID , String typeCommandName , String argument )
5868 {
5969 lastUse (userID );
60- String fileKey = typeCommandName + ".name." + argument ;
70+ String jsonKey = typeCommandName + ".name." + argument ;
6171 JSONObject hasKeyFile ;
62- if (file .has (fileKey )) //如果有這個key
72+ if (file .has (jsonKey )) //如果有這個key
6373 hasKeyFile = file ;
64- else if (englishFile .has (fileKey )) //預設使用英文
74+ else if (englishFile .has (jsonKey )) //預設使用英文
6575 hasKeyFile = englishFile ;
6676 else
6777 return file .getString (typeCommandName + ".fail" );
0 commit comments