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

Old posts that have not been replied to for several years.
Locked
l
laidas
Voice
Posts: 18
Joined: Thu Jul 25, 2002 10:07 am

help with bans

Post by laidas »

how bot can unban itself ?

Situation:
Dalnet IRC server.
Bot has 10 access level. Me too :)
My actions:
[15:15:27] * msn was kicked by laidas (laidas)
[15:15:27] * laidas sets mode: +b *!*@213.226.133.40
[15:15:29] -irc2.omnitel.net:@#lamest- ChanServ invited msn into channel #lamest.
[15:15:30] * Joins: msn (eggdrop@213.226.133.40)
[15:15:30] * ChanServ sets mode: +o msn
But ban *!*@213.226.133.40 still on chan...
how can bot unban itself on chan ?

Thanx..
k
karlmiller

Post by karlmiller »

laidas,

I don't know how to do this with a TCL script, but its possible to do using the config file:

Unfortunatly, i do not use dalnet and so i don't know what sort of commands is used for unbanning, but on KnightNet I use the following in my chan information in the config file:

channel add #AllNiteCafe {
chanmode "+nt"
idle-kick 0
need-op {
puthelp "PRIVMSG Tavernserv :op #AllNiteCafe Bot"
}
need-invite {
puthelp "PRIVMSG Tavernserv :invite #AllNiteCafe" }
need-unban {
puthelp "PRIVMSG Tavernserv :unban #AllNiteCafe"
}

of course, to do this the bot must already be identifyed to nickserv (tell it to in the init-server bit of the conf. With a slight bit of tailoring with that you should be able to use it.

Hope this helps you.

Good Luck.


Karl (EvilPhish)


later on......there are many scripts avaliable for this kind of thing. check slennox's script archive
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Or you can use this code:

Code: Select all

setudef flag myneeds

bind need - * my:needs

proc my:needs {channel type} { 
  global botnick
  if {[lsearch -exact [channel info $channel] -myneeds] != -1} { return 0 }
  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 }
  }
}
Simply copy/paste it in to a tcl file and load it to your bot, then do a .chanset #channel +myneeds where #channel is the channel(s) where you want it to interact with Chanserv.

Oh, as for weird ban thing.. duno what to say. I've deoped it, then placed a ban on its mask then oped it back. He didn't removed the ban that matches him weird..
Once the game is over, the king and the pawn go back in the same box.
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 - * op:mode

proc op:mode {nick uhost hand chan mc ban} {
  global botnick botname
  foreach ban [chanbans $chan] {
    set mask [lindex $ban 0]
    if {[string match "$mask" "$botname"]} {
      putquick "MODE $chan -b $ban"
    }
  }
}
The eggdrop has it's own buit in mechanism to unban itself if has ops in the channel so there will be needed only the +o bind mode. When he is oped pn channel he will do a compare on each channel bans against it's mask and unban it if matches him.

Here is another code with binds for '+b' and '+o' if anyone needs it or something..

Code: Select all

bind mode - * ch:modes

proc ch:modes {nick uhost hand chan mc ban} {
  global botnick botname
  switch -- $mc {
    "+b" {
      if {[string match "$ban" "$botname"] && [botisop $chan]} {
        putquick "MODE $chan -b $ban"
        return
      }
    }
    +o {
      foreach ban [chanbans $chan] {
        set mask [lindex $ban 0]
        if {[string match "$mask" "$botname"]} {
          putquick "MODE $chan -b $ban"
        }
      }
    }
  }
}
Once the game is over, the king and the pawn go back in the same box.
Locked