bot.eval: inspect non errors only, not just all strings
This commit is contained in:
		
							parent
							
								
									0b470e7cf7
								
							
						
					
					
						commit
						16cb278e6c
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
					@ -52,13 +52,13 @@ _eval.callback = async function (msg, line) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
    out = eval(line);
 | 
					    out = eval(line);
 | 
				
			||||||
    if (out && out.then) out = await out;
 | 
					    if (out && out instanceof Promise) out = await out;
 | 
				
			||||||
  } catch (err) {
 | 
					  } catch (err) {
 | 
				
			||||||
    out = err.message ? err.message : err;
 | 
					    out = err.toString();
 | 
				
			||||||
    errored = true;
 | 
					    errored = true;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  out = typeof out == "string" ? out : inspect(out, {depth: 0});
 | 
					  out = errored ? out : inspect(out, {depth: 0});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const token = hf.config.token;
 | 
					  const token = hf.config.token;
 | 
				
			||||||
  out = out.replace(
 | 
					  out = out.replace(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue