| View previous topic :: View next topic |
| Author |
Message |
mavericku Halfop

Joined: 12 Jun 2005 Posts: 62 Location: somewhere in the world
|
Posted: Thu Dec 07, 2006 6:44 pm Post subject: unban help... [solved] |
|
|
a quick question guys..
i have a script that responds to .ub (host) and unbans the host trough killchanban and privmsg x ..
but it will do it only if the ban is on the channel banlist .. if it isn't it doesn't do nothing ..
can you help me out with this?
i'd like it to remove the ban from its internal banlist even if it is not on the channel banlist.
here is the code.
| Code: |
bind pub n|o .ub pub:ub
proc pub:ub {nick uhost hand chan text} {
global botnick drchan drreason opsc
if {[botisop $drchan]} {
if {[string length $text] > 0} {
set tnick [lindex $text 0]
if {[ischanban $tnick $drchan]} {
killchanban $drchan $tnick
putquick "privmsg X :unban $drchan $tnick"
putserv "privmsg $opsc :$hand/$nick: Am scos ban-ul \002$tnick\002 de pe $drchan"
} else { puthelp "prvmsg X :unban $drchan $tnick" }
} else { puthelp "NOTICE $nick :SYNTAX: .ub <nick!user@host> - unbans an address" }
} else { puthelp "NOTICE $nick :Pfff n-am op!" }
}
|
Thanks in advance ... _________________ mavericku
Last edited by mavericku on Fri Dec 08, 2006 3:08 pm; edited 1 time in total |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Thu Dec 07, 2006 6:51 pm Post subject: |
|
|
put another test in there like:
| Code: |
if {[isban $tnick]} {killban $tnick}
|
|
|
| Back to top |
|
 |
mavericku Halfop

Joined: 12 Jun 2005 Posts: 62 Location: somewhere in the world
|
Posted: Fri Dec 08, 2006 2:41 pm Post subject: |
|
|
rosc2112, thanks for your help .. but it doesn't work ..
as i know the "killban" command removes a ban from the GLOBAL banlist .. not from a channel banlist... ( in the bots internal banlist) ...
correct me if i`m wrong ..
New code :
| Code: |
bind pub n|o .ub pub:ub
proc pub:ub {nick uhost hand chan text} {
global botnick drchan drreason opsc
if {[botisop $drchan]} {
if {[string length $text] > 0} {
set tnick [lindex $text 0]
if {[ischanban $tnick $drchan]} {
killchanban $drchan $tnick
putquick "privmsg X :unban $drchan $tnick"
putserv "privmsg $opsc :$hand/$nick: I removed \002$tnick\002 from $drchan" }
if {[isban $tnick]}
killban $tnick
} else { puthelp "NOTICE $nick : I can't see that ban in the channel list" }
} else { puthelp "NOTICE $nick :SYNTAX: .ub <nick!user@host> - unbans an address" }
} else { puthelp "NOTICE $nick :Pfff n-am op!" }
}
|
Did i do something wrong? ...
Thanks again _________________ mavericku |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri Dec 08, 2006 2:51 pm Post subject: |
|
|
[ischanban] checks if the ban exists in the channel's banlist (not the bot's) so to check if a ban exists in the bot's ban list you need to use [isban] instead, so replacing the command will probably solve your problem. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
mavericku Halfop

Joined: 12 Jun 2005 Posts: 62 Location: somewhere in the world
|
Posted: Fri Dec 08, 2006 3:07 pm Post subject: |
|
|
Thanks guys .. it works ...  _________________ mavericku |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Fri Dec 08, 2006 3:28 pm Post subject: |
|
|
Mav, your code is hard to read, it would be a big help to you (and us! if you tabulate correctly and put closing braces below the line that if's and such finish on, like:
| Code: |
if {$foo == "bar"} {
dosomething
dosomething else
if {$whatever == "foo"} {
more junk
blah blah
}
}
|
instead of like you had:
| Code: |
if {[ischanban $tnick $drchan]} {
stuff
more stuff
blah blah stuff }
|
Using tabs is, imo, preferable to using spaces, cos it's much easier to see where segments begin and end, compared to:
| Code: |
if {$blah} {
if {$foo} {
} else {
if {$biz} {
}
|
Just some suggestions, it would make your script writing/debugging easier for you (and us!  |
|
| Back to top |
|
 |
mavericku Halfop

Joined: 12 Jun 2005 Posts: 62 Location: somewhere in the world
|
Posted: Fri Dec 08, 2006 6:05 pm Post subject: |
|
|
thank you for your suggestion,i will make it readable as soon as i have some free time on my hands.
The thing is i`m not such a good scripter ... a n00b actualy...
I just realised that .. even if i made it for me (i know where and what does) it needs to be ... readable (for problems like this)
Thank you again.  _________________ mavericku |
|
| Back to top |
|
 |
|