;--------------------------------------------------------------------------------------------------------:
;
; - !quotes!cript...
;
on *:text:!quote*:*: {
if ($level($address($nick,8)) == Quote.Ban) { return }
else var %who = $nick
if (%quote.delay) {
.msg $nick Please try again after random delay of: $duration(%quote.delay)
return
}
else {
var %delay = $rand(25,35)
set -u [ $+ [ %delay ] ] %quote.delay %delay
}
if ($chan) {
if (!$istok(#filosofisk #filosofi #åndelighet,$chan,32)) { return }
var %who = $chan
}
if ($2) {
if ($2 !isnum) {
window -h @quote.search
loadbuf -r @quote.search quotes.txt
var %quote.temp $fline(@quote.search,$+(*,$2-,*),0)
if (%quote.temp isnum 1-20) {
var %i = 1,%quote.match
while ($fline(@quote.search,$+(*,$2-,*),%i)) {
%quote.match = $addtok(%quote.match,$v1,44)
inc %i
}
msg $chan Matches for $2 --> %quote.match
window -c @quote.search
}
elseif (%quote.temp == 0) { msg $chan No match found. }
else { msg $chan More than 20 matches found, please narrow your search down }
}
else {
if ($lines(quotes.txt) < $2) { msg %who Quote $chr(35) $+ $2 doesn't exist. | return }
msg %who $read(quotes.txt,$2)
}
}
elseif ($1 == !quotes) { msg %who Total quotes!: $lines(quotes.txt) }
else {
msg %who $read(quotes.txt)
}
}
on *:text:!addquote*:*: {
if ($2 == $null) { .notice $nick You need to include a quote to add. }
if (%quote.delay) {
.msg $nick Please try again after random delay of: $duration(%quote.delay)
return
}
else {
var %delay = $rand(25,35)
set -u [ $+ [ %delay ] ] %quote.delay %delay
}
write quotes.txt $2-
}
menu nicklist {
!Quote Ban: auser Quote.Ban $address($snick($chan,1),8)
}
on *:input:*: {
if ($1 == !quote) {
var %who = $iif($chan,$chan,$me)
if ($chan) {
if (!$istok(#filosofisk #filosofi #åndelighet,$chan,32)) { return }
}
if ($2) {
if ($2 !isnum) {
window -h @quote.search
loadbuf -r @quote.search quotes.txt
var %quote.temp $fline(@quote.search,$+(*,$2-,*),0)
if (%quote.temp isnum 1-20) {
var %i = 1,%quote.match
while ($fline(@quote.search,$+(*,$2-,*),%i)) {
%quote.match = $addtok(%quote.match,$v1,44)
inc %i
}
msg $chan Matches for $2 --> %quote.match
window -c @quote.search
}
elseif (%quote.temp == 0) { msg $chan No match found. }
else { msg $chan More than 20 matches found, please narrow your search down }
}
else {
if ($lines(quotes.txt) < $2) { msg %who Quote $chr(35) $+ $2 doesn't exist. | return }
msg %who $read(quotes.txt,$2)
}
}
else {
msg %who $read(quotes.txt)
}
}
elseif ($1 == !quotes) { msg %who Total quotes!: $lines(quotes.txt) }
elseif ($1 == !addquote) {
if ($2 == $null) { echo -a You need to include a quote to add. }
else write quotes.txt $2-
}
}
on *:text:!help:#: {
if (%quote.delay) {
.msg $nick Please try again after random delay of: $duration(%quote.delay)
return
}
else {
var %delay = $rand(25,35)
set -u [ $+ [ %delay ] ] %quote.delay %delay
}
msg $nick Available commands: !quote, !quotes, !quote "number", and !addquote "quote" - Author. And: !quote "word" to search...
}
:-----------------
Not sure if I need all that, but it works perfectly now!
At least I hope it cannot be abused more. :p It should perhaps be some flood protect on the "please try again after random delay" ...
Is there a simple way to make it only be sent one time, for each user?
if (%quote.delay) {
.msg $nick Please try again after random delay of: $duration(%quote.delay)
return
}
else {
var %delay = $rand(25,35)
set -u [ $+ [ %delay ] ] %quote.delay %delay
}
...that part I mean.
As it is now, I guess people can do like this:
[16:14:25] <IAmPartOf> !quote
[16:14:25] <Curious> "ONLY the INDIVIDUAL may separate from the/a WHOLE ... "
[16:14:25] <IAmPartOf> !quote
[16:14:26] <Curious> Please try again after random delay of: 30secs
[16:14:26] <IAmPartOf> !quote
[16:14:26] <Curious> Please try again after random delay of: 30secs
[16:14:26] <IAmPartOf> !quote
[16:14:27] <Curious> Please try again after random delay of: 30secs
[16:14:27] <IAmPartOf> !quote
[16:14:27] <Curious> Please try again after random delay of: 30secs
[16:14:27] <IAmPartOf> !quote
[16:14:28] <Curious> Please try again after random delay of: 30secs
[16:14:28] <IAmPartOf> !quote
[16:14:28] <Curious> Please try again after random delay of: 30secs
[16:14:28] <IAmPartOf> !quote
[16:14:29] <Curious> Please try again after random delay of: 30secs
[16:14:29] <IAmPartOf> !quote
[16:14:29] <Curious> Please try again after random delay of: 30secs
[16:14:29] <IAmPartOf> !quote
[16:14:29] <Curious> Please try again after random delay of: 30secs
But, I do not know if that will disconnect me or not..
I shall play around with (!%antiflood) some more. But please help if any of you can think of a simple sulution.