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.

Bot self ban protection

Old posts that have not been replied to for several years.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Bot self ban protection

Post by Sir_Fz »

Well, i couldn't find a good script for this (Even in the archive)

can someone give me a script that unbans itself and deops the user who bans it (using chanserv too [on DALnet]) please :D
User avatar
MD87
Voice
Posts: 23
Joined: Sat Dec 14, 2002 9:04 am
Location: Leicester, UK
Contact:

Post by MD87 »

I'm not too sure about the chanserv stuff, but this will work for general ban protection:

Code: Select all


bind mode -|- "* +b" ban:check
# Catches all bans

proc ban:check { nick address handle channel mode victim } {
  if { [string match [string tolower $victim] [string tolower "$botnick!$botname"]]  } {
  # If the bot was banned...
    pushmode $channel -o $nick
    pushmode $channe -b $victim
    # Deop the user & unban
  }
}

User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

bind mode - "* +b" channel:ban

proc channel:ban {nick uhost hand chan mc ban} {
  if {[string match "$ban" "$::botname"] && [botisop $chan]} {
    putquick "MODE $chan -b $ban"
    if {[matchattr $hand mn|mn $chan] == 0} {
      set mask "*!*@[lindex [split $uhost @] 1]"
      newchanban $chan $mask Moron "don't ban me moron!" 1440
    }
  }
}
It will just unban itself if the users who sets an ban that matches him is an known master or owner globaly or on channel. Also you may try/use it's "needs" with something like:

Code: Select all

bind need - * my:needs

proc my:needs {channel type} { 
  switch -- $type {
    "op" {
      putserv "PRIVMSG ChanServ :op $channel $::botnick"
      return 1
    }
    "unban" {
      putserv "PRIVMSG ChanServ :unban $channel $::botnick"
      return 1
    }
    "invite" {
      putserv "PRIVMSG ChanServ :invite $channel $::botnick"
      return 1
    }
    "limit" {
      putserv "PRIVMSG ChanServ :invite $channel $::botnick"
      return 1
    }
  }
}
Don't know exactly how tohandle the ChanServ in this situations, just take my reply as an ideea or something like this..
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 »

well doesn't the "newchanban" set a global ban? like for example if the user who banned the bot rejoins the channel, the bot will kick it again by the reason "Banned: don't ban me moron!" ?

all i want it to do is unban itself, deop the user and msg chanserv@services.dal.net deop #channel $nick ; no global bans only channel bans can u do that for me please ?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Don't supposed your read what you typed did you?

newchanban

newchanban

newchanban

Read that command, memorize it.

This is a channel command.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

1. newchanban = an new channel ban and newban = an new global ban;
2. this part of the code:

Code: Select all

    if {[matchattr $hand mn|mn $chan] == 0} { 
      set mask "*!*@[lindex [split $uhost @] 1]" 
      newchanban $chan $mask Moron "don't ban me moron!" 1440 
    }
dose a check to see if the one that places an ban that matches his host is not an known user to it with friend or op flags. You may remove them if you don't want this feature. Also you may replace this line:

Code: Select all

  putquick "MODE $chan -b $ban"
with this:

Code: Select all

pushmode $chan -bo $ban $nick
and will do the unban and deop of the person who set's a ban that matches him in the same line. Also, for a chanserv msg use something like:

Code: Select all

putserv "PRIVMSG ChanServ :deop $channel $nick"
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 »

Code: Select all

bind mode - "* +b" channel:ban 

proc channel:ban {nick uhost hand chan mc ban} { 
  if {[string match "$ban" "$::botname"] && [botisop $chan]} { 
    pushmode $chan -bo $ban $nick
    putserv "PRIVMSG Chanserv@Services.dal.net :deop $channel $nick" 
    if {[matchattr $hand mn|mn $chan] == 0} { 
      set mask "*!*@[lindex [split $uhost @] 1]" 
      newchanban $chan $mask Moron "Don't Ban me, You know that's not a good idea." 1440 
    } 
  } 
}
this will function correctly right ?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

[11:26] Tcl error [channel:ban]: can't read "channel&qu

Post by Sir_Fz »

[11:26] Tcl error [channel:ban]: can't read "channel": no such variable
thats what appears after using this code :

Code: Select all

bind mode - "* +b" channel:ban

proc channel:ban {nick uhost hand chan mc ban} {
  if {[string match "$ban" "$::botname"] && [botisop $chan]} {
    putquick "MODE $chan -bo $ban $nick"    
    putserv "PRIVMSG Chanserv@Services.dal.net :deop $channel $nick"
    if {[matchattr $hand mn|mn $chan] == 0} {
      set mask "*!*@[lindex [split $uhost @] 1]"
      newchanban $chan $mask Moron "Don't Ban me, You know that's not a good idea." 1440
    }
  }
}
it sets mode -bo host nick

but it doesn't kick him (the newchanban doesn't work)
can u tell where's the mistake in the code please :roll:

Thanx Alot :)
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

putserv "PRIVMSG Chanserv@Services.dal.net :deop $channel $nick"
now... from the tcl-error you got you should with some comon sence manage to figure out what's wrong
Elen sila lúmenn' omentielvo
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Actualy it works, you don't have that channel +enforcebans, that's why he dosen't kick the user. Alternativly you can add a line like this:

Code: Select all

putkick $chan $nick "Ban me, You know that's not a good idea."
after the newchanban line..

In case you haven't noticed what should be replaced to get ridd of that error, replace from this:

Code: Select all

putserv "PRIVMSG Chanserv@Services.dal.net :deop $channel $nick"
to this:

Code: Select all

putserv "PRIVMSG Chanserv@Services.dal.net :deop $chan $nick"
Hard to crack this nutt.. :)
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:

thanx :)

Post by Sir_Fz »

thanx bro, i figured that out by common sense :p

and thanx for the putquick :)
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

bind mode - "* +b" channel:ban

proc channel:ban {nick uhost hand chan mc ban} {
  if {[string match "$ban" "$::botname"] && [botisop $chan]} {
    putquick "MODE $chan -bo $ban $nick"
    putserv "PRIVMSG Chanserv@Services.dal.net :deop $chan $nick"   
    if {[matchattr $hand mn|mn $chan] == 0} {
      set mask "*!*@[lindex [split $uhost @] 1]"
      putkick $chan $nick "Don't Ban me, You know that's not a good idea."              
      putquick "MODE $chan +b $mask"
    }
  }
}[code]
this should work correctly righ ?
sorry for being annoying, but this is the last request, I don't want the bot to apply those triggers on itself (incase the bot bans himself). what's the solution ?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

There is no need for what you ask because he won't place bans that matches his host.
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 »

Well; there was this notice from the server once which said : Server Flood Protection Activated on #Channel
and the bot sets mode to +b *!*@*
then he sets mode -ob $botnick *!*@*
-----------------------------
so I want that code just incase it does it again.

also this script doesn't work when a person bans *!*@host, it only works when a person bans *!*@* or $botnick!*@* or *!bot-ident@*, i couldn't figure it out..

and also one more question, if I put putquick "PRIVMSG...." instead of putserv "PRIVMSG...." it will function faster right ?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Sorry, the script works for any types of bans set on the bot :)
the script works perfectly :)

but can somebody answer if putquick "PRIVMSG..." works faster than putserv "PRIVMSG....." and the bot self exmpt too :)

thanx
Locked