roll: move 0 and 1 checks above everything
This commit is contained in:
		
							parent
							
								
									1f5971d52d
								
							
						
					
					
						commit
						16ea0aaef0
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -7,12 +7,13 @@ roll.usage = "<sides>";
 | 
			
		|||
roll.addAlias("img");
 | 
			
		||||
roll.callback = function (msg, line) {
 | 
			
		||||
  line = Number(line);
 | 
			
		||||
  if (line == null || line == "" || Number.isNaN(line)) line = 6;
 | 
			
		||||
  if (line < 0) line = Math.abs(line);
 | 
			
		||||
 | 
			
		||||
  if (line == 0) return ":hole:";
 | 
			
		||||
  if (line == 1) return ":one:";
 | 
			
		||||
 | 
			
		||||
  if (line == null || line == "" || Number.isNaN(line)) line = 6;
 | 
			
		||||
  if (line < 0) line = Math.abs(line);
 | 
			
		||||
 | 
			
		||||
  const res = Math.floor(Math.random() * line);
 | 
			
		||||
 | 
			
		||||
  if (line == 2) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue