Your best option might be to get a script that's already made for handling spam. But, if you want something to handle a particular type of spam message...
Code:
on @*:text:*:#: {
if (*click here for porn* iswm $1-) { Spammer $nick $chan }
elseif (*here is sex* iswm $1-) { Spammer $nick $chan }
}
alias Spammer {
ban $2 $address($1,2)
kick $2 $1 Spammer!
mode $2 +m
.timermoderated.timer 1 240 { mode $2 -m }
}
* Note that you can stick the if/elseif lines together using || (or). I left them separate to make it easier to see and understand.