the if-line timeouts fine if the banmask is the only thing said. but it doesn't work if there are words in front or after the banmask.
nor if it's inside a lot text like "wwwwwwwwwbanmaskzzzzzzzzzzz"
really bad at scripting from scratch. been looking through other codes and tried to put this together myself.
on 1:TEXT:*:#:{
; this if-line below is the one I do not get to work as I want. formerly used "==" instead of "isin" which
; didn't work either.
if ($1- isin $read(bans- $+ $chan $+ .txt,w, $1-)) { .msg $chan .timeout $nick | echo # 14(00 $+ $time $+ 14) 10-11-15- 5min timeout on $nick }
elseif ($1 == !addban) {
if ($2- == $read(bans- $+ $chan $+ .txt,w, $2-)) { msg $chan banmask " $+ $2- $+ " is already added. }
else { write bans- $+ $chan $+ .txt $2- | msg $chan banmask " $+ $2- $+ " added. }
}
elseif ($1 == !delban) {
if ($2- != $read(bans- $+ $chan $+ .txt,w, $2-)) { msg $chan no such banmask " $+ $2- $+ ". }
else { write -ds " $+ $2- $+ " bans- $+ $chan $+ .txt | msg $chan banmask " $+ $2- $+ " deleted. }
}
}
if ($1- isin $read(bans- $+ $chan $+ .txt,w, $1-))
That's not working seen as you (For some reason.) HAVE to use variables to make that work. Just like this one:
echo # 14(00 $+ $time $+ 14) 10-11-15- 5min timeout on $nick
You also didn't define how long you want $nick to be timed out.
.msg $chan .timeout $nick |
In other words:
on 1:TEXT:*:#:{
var %readbans bans- $+ $chan $+ .txt
var %echotime 00 $+ $time $+ 14
if ($1- isin $read(%readbans,w, $1-)) { .msg $chan .timeout $nick 10 | echo # 14(%echotime) 10-11-15- 5min timeout on $nick }
elseif ($1 == !addban) {
if ($2- == $read(%readbans,w, $2-)) { msg $chan banmask " $+ $2- $+ " is already added. }
else { write %readbans $2- | msg $chan banmask " $+ $2- $+ " added. }
}
elseif ($1 == !delban) {
if ($2- != $read(%readbans,w, $2-)) { msg $chan no such banmask " $+ $2- $+ ". }
else { write -ds " $+ $2- $+ " %readbans | msg $chan banmask " $+ $2- $+ " deleted. }
}
}
that ought to do the trick. Try it.
You don't have to modify the !addban/!delban parts. This is just WAY easier when making modifycations. With some editing you could host this on multiple streams and once with just 1 script running. Don't get me wrong, but that's EXACTLY how Moobot, Nightbot Saucebot etc do their stuff. The have 1 script made to differ in options between streams. Now it's your tunr to figure out how and apply that. Then to become as famous as a bot like Moobot and Nightbot you'd have to pull some serious strings by some big-ass streams.
i am not the best with while loops myself but i believe this should work
on 1:TEXT:*:#:{
var %a = 1, %b = $lines(bans- $+ $chan $+ .txt)
while (%a <= %b) {
if ($read(bans- $+ $chan $+ .txt, %a) isin $1-) {
.msg $chan .timeout $nick
echo # 14(00 $+ $time $+ 14) 10-11-15- 5min timeout on $nick
inc %a
}
inc %a
}
elseif ($1 == !addban) {
if ($2 == $read(bans- $+ $chan $+ .txt,w, $2-)) { msg $chan banmask " $+ $2- $+ " is already added. }
else { write bans- $+ $chan $+ .txt $2- | msg $chan banmask " $+ $2- $+ " added. }
}
elseif ($1 == !delban) {
if ($2 != $read(bans- $+ $chan $+ .txt,w, $2-)) { msg $chan no such banmask " $+ $2- $+ ". }
else { write -ds " $+ $2- $+ " bans- $+ $chan $+ .txt | msg $chan banmask " $+ $2- $+ " deleted. }
}
}
von 1:TEXT:*:#:{
var %a = 1, %b = $lines(bans- $+ $chan $+ .txt)
while (%a <= %b) {
if ($read(bans- $+ $chan $+ .txt, %a) isin $1-) {
.msg $chan .timeout $nick
echo # 14(00 $+ $time $+ 14) 10-11-15- 5min timeout on $nick
inc %a
}
elseif ($1 == !addban) {
if ($2 == $read(bans- $+ $chan $+ .txt,w, $2-)) { msg $chan banmask " $+ $2- $+ " is already added. }
else { write bans- $+ $chan $+ .txt $2- | msg $chan banmask " $+ $2- $+ " added. }
}
elseif ($1 == !delban) {
if ($2 != $read(bans- $+ $chan $+ .txt,w, $2-)) { msg $chan no such banmask " $+ $2- $+ ". }
else { write -ds " $+ $2- $+ " bans- $+ $chan $+ .txt | msg $chan banmask " $+ $2- $+ " deleted. }
}
}
}
First thing I did was trying to add a banmask:
(10:22:15) (menteroth) !addban megamongo
(10:22:17) (mentbot) banmask "megamongo" added.
(10:22:17) (mentbot) banmask "megamongo" is already added.
(10:22:18) (mentbot) banmask "megamongo" is already added.
(10:22:18) (mentbot) banmask "megamongo" is already added.
(10:22:18) (mentbot) banmask "megamongo" is already added.
(10:22:18) (mentbot) banmask "megamongo" is already added.
(10:22:19) (mentbot) banmask "megamongo" is already added.
(10:22:19) (mentbot) banmask "megamongo" is already added.
(10:22:19) (mentbot) banmask "megamongo" is already added.
(10:22:19) (mentbot) banmask "megamongo" is already added.
(10:22:20) (mentbot) banmask "megamongo" is already added.
(10:22:20) (mentbot) banmask "megamongo" is already added.
(10:22:20) (mentbot) banmask "megamongo" is already added.
(10:22:21) (mentbot) banmask "megamongo" is already added.
like 20 times more of this segment until it disconnected for flooding.
hello. thanks for the help. I will try this when I get the time and get back to you.
and for the timeout. I don't need to set time since the default is 5 minutes. this is a twitch.tv IRC-channel I'm using the script for. so that's fine. :)
and I don't need to change the !addban/!delban parts. they work as intended. I can add and remove several words banmasks.