//newer wikis does not have an entry under wikia.com anymore
//alternative search endpoint (more of an autocomplete only but much faster): "https://" + wiki + ".fandom.com/wikia.php?controller=UnifiedSearchSuggestions&method=getSuggestions&format=json&scope=internal&query=" + search
url=(HttpURLConnection)newURL("https://"+wiki+".fandom.com/api.php?action=query&format=json&list=search&srsearch="+search).openConnection();//sometimes this has no results (new wikis?)
if(url.getResponseCode()==404){
returnnewCommandResult(CommandResultType.FAILURE,"Unknown wiki name!");//404 means unknown wiki now
//only use until the last full stop before table of content or end for slightly better formatting
//there might be false positives for table of content detection since its just checking 1 after full stop, but honestly rarely less details > commonly being ugly af
Stringdesc=info.getString("abstract").replaceAll("^(?:(.*?\\.) ?1 .*|(.*\\.) .*?)$","$1$2");//greedy if table of content is present, else lazy to get the last
eb.setDescription(desc.matches(".*\\.$")?desc:(desc+"..."));//if everything fails (aka last char aint a full stop) give it the good ol ... treatment
if(!info.isNull("thumbnail"))eb.setThumbnail(info.getString("thumbnail").substring(0,info.getString("thumbnail").indexOf("/revision/")));//get full img by trimming revision path
eb.setFooter("Last edited by "+info.getJSONObject("revision").getString("user"),null);