This is called a cooldown, or just anti flood, you can search this forum for that and you'll get a lot of results, but what you want is quite simple, set a variable which will last 3 secs when you process the !dostuff, and check the variable doesn't exist before doing so:
on *:text:!help:#:{
if (!%antiflood) {
do_test $nick
set -u3 %antiflood 1
}
}
-u3 means the variable will be unset automatically after 3 seconds, we give the variable the value 1 as a bool value, if (!%antiflood) basically means 'if the variable isn't set'