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.

Help With Bans in TCL Script

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
a
achilles1900
Voice
Posts: 30
Joined: Mon Apr 21, 2008 5:40 am

Help With Bans in TCL Script

Post by achilles1900 »

Hi people,

the following is the bans section in Op Commands by xTc^bLiTz
I dont know TCL so i hope some kind soul can take a look at it work it out.

1. I would like the bot to ban with : *!*user@*.host.domain which it is currently not doing.
(FYI I do the public command !ban (nick) )

2. When I try to do !unban (nick) it tells me that there is no user in the banlist, although i see the host there. Anyway to fix this?

Thanks in advance for your time and efforts :) . Following is attached the TCL code

Code: Select all

# Ban Process

proc proc_ban { nick uhost hand chan text } {
  global botnick
  if {[onchan $text]} {
    if {$text == $botnick} { return 0 }
    set banmask [getchanhost $text $chan]
    putquick "MODE $chan +b $banmask"
    putkick $chan $text :Requested
  } else { putserv "PRIVMSG $chan :$text Is Not In The Channel" }
}

# Unban Process

proc proc_unban { nick uhost hand chan text } {
  if {[ischanban $text $chan]} {
    pushmode $chan -b $text
  } else { putserv "PRIVMSG $chan :$text Is Not In The Ban List" }
}
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

It's the host you unban (as per the list), not the nick.

.i.e !unban *!*user@*.host.domain
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Replace

Code: Select all

[getchanhost $text $chan]
with

Code: Select all

[maskhost [getchanhost $text $chan]]
as for !unbaning nick, use this proc instead of yours:

Code: Select all

# Unban Process

proc proc_unban { nick uhost hand chan text } {
 set mask $text![getchanhost $text $chan]
 set found 0
 foreach ban [chanbans $chan] {
  set ban [lindex $ban 0]
  if {[string match -nocase $ban $mask]} {
   pushmode $chan -b $ban
   set found 1
  }
 }
 if {!$found} {
  puthelp "PRIVMSG $chan :$text Is Not In The Ban List"
 }
}
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

Mmmm... if the user is banned, I wouldn't suspect he's on the channel necessarily... so getchanhost will most likely fail.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

strikelight wrote:Mmmm... if the user is banned, I wouldn't suspect he's on the channel neccessarily... so getchanhost will most likely fail.
Good observation there, didn't think about it frankly :lol: so achilles1900, you want the bot to whois the banned nick and try to unban any bans set on it?
a
achilles1900
Voice
Posts: 30
Joined: Mon Apr 21, 2008 5:40 am

Post by achilles1900 »

Hi Sir_FZ , strikealight & alchera,

thanks for your reply and help.
Good observation there, didn't think about it frankly so achilles1900, you want the bot to whois the banned nick and try to unban any bans set on it?
Yes that would be very helpful! :D
Post Reply