misc.search: forgetting syntax moment
This commit is contained in:
		
							parent
							
								
									906baf31c2
								
							
						
					
					
						commit
						6968680899
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -552,11 +552,12 @@ search.helpText = "Search, powered by LibreX";
 | 
			
		|||
search.addAlias("g");
 | 
			
		||||
search.addAlias("google");
 | 
			
		||||
search.addAlias("ddg");
 | 
			
		||||
search.callback = async function (msg, line, {results = 2}, [query]) {
 | 
			
		||||
search.callback = async function (msg, line, args, {results = 2}) {
 | 
			
		||||
  const query = args.join(" ");
 | 
			
		||||
  if (!librex) return "LibreX instance not defined.";
 | 
			
		||||
  if (!query || query == "") return "Search query required.";
 | 
			
		||||
 | 
			
		||||
  const encodedQuery = encodeURIComponent(line);
 | 
			
		||||
  const encodedQuery = encodeURIComponent(query);
 | 
			
		||||
 | 
			
		||||
  if (line.startsWith("!")) {
 | 
			
		||||
    const url = `https://api.duckduckgo.com/?q=${encodedQuery}&format=json`;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue