Originally Posted By: Wims
Check that the parameter is a whole number, meaning there is only digit in it, regex can quickly do that, you basically only want to accept digit from 1 to 9, included:
Code:
if (!$regex($2,^[1-9]$)) {
    msg $chan /me $nick to use the !top command you must specify a positive integer.
  }
Without regex, you could check that with $istok:
Code:
if (!$istok(1 2 3 4 5 6 7 8 9,$2,32)) {


To add to this for future viewers if you wish to allow numbers greater than 1-9 without hardcoding a ton of number tokens (without using regex) you can use:

Code:
if ($round($2,0) == $2) { }


Which will ensure that your number is a whole number. That being said it will still allow you to do things like: "1.00000000" at which point you can just used the rounded output instead of using $2.