This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

temp ban if not on both channels

Old posts that have not been replied to for several years.
Locked
Y
Yoinx
Voice
Posts: 13
Joined: Thu Jan 01, 2004 5:44 pm

temp ban if not on both channels

Post by Yoinx »

Basically what im trying to do is have the bot set up so that it will check to see if a user is on both of two channels, if they arent i want it to set a temporary ban. I tried modifying one of the premade scripts that came with the bot then got a reply on a post on another forum where someone had helped me with my coding and ended up with:

set main_chan "#bottest"
set req_chan "#bottest2"

bind join - * join_main

proc join_main {nick uhost hand chan} {
if {([string tolower $nick] != [string tolower $botnick]) && (![onchan $nick $main_chan] || ![onchan $nick $req_chan])} {

pushmode $main_chan +b $nick!*@*
}
}


The only problem with this though is it checks on both channels ... all i really want it to do is when someone joins main_chan check req_chan to see if they're on it. If they arent I want to temp ban them from main chan. if someone could help i would appreciate it
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

set main_chan "#bottest" 
set req_chan "#bottest2" 

bind join - "$main_chan *" join_main 

proc join_main {nick uhost hand chan} { 
if {"[string tolower $nick]" != "[string tolower $botnick]" && ![onchan $nick $::req_chan]} { 
newchanban $chan *!*@[lindex [split $uhost @] 1] notonchan "You're not allowed to join here unless you're in $::req_chan" 2
 } 
}
this will check joins in $main_chan, if the nick is not on $req_chan he will be banned from $main_chan for 2 mins.
Y
Yoinx
Voice
Posts: 13
Joined: Thu Jan 01, 2004 5:44 pm

Post by Yoinx »

Thanks Sir_FZ I appreciate the help
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Lil tip: Instead of if "[string tolower $nick]" != "![string tolower $botnick]" use "[string equal -nocase $nick $::botnick]" (and don't forget to drop the " cos are not needed, are just for human look.)
Once the game is over, the king and the pawn go back in the same box.
Y
Yoinx
Voice
Posts: 13
Joined: Thu Jan 01, 2004 5:44 pm

Post by Yoinx »

The other thing i needed to ask is, im using thsi bot to monito irc channels not botnet channels, if that changes the code any... cuz it doesnt seem to work when I tried it.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

It should work, are there any errors ?
Y
Yoinx
Voice
Posts: 13
Joined: Thu Jan 01, 2004 5:44 pm

Post by Yoinx »

not none as far as i could tell, but its running on a remote shell as a bg proc so i cant really tell.. its pretty well just ignored everything.
Y
Yoinx
Voice
Posts: 13
Joined: Thu Jan 01, 2004 5:44 pm

Post by Yoinx »

ok i finally got the listing, the first error is

Tcl error [join_main]: can't read "botnick": no such variable

I'm gonna try to set that btu i thought it was already suposed to be set
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Either add an "global botnick" line before the first if or add two :: like $::botnick insted of $botnick
Once the game is over, the king and the pawn go back in the same box.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

The day will come when I'll stop doing these mistakes :P
Locked