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.

Unbanning through the bot.

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
S
Skipper
Voice
Posts: 29
Joined: Sun Aug 21, 2005 10:00 am

Unbanning through the bot.

Post by Skipper »

Hello ppl,

Script needed :- To unban a channel ban where the bot is opped.
The ops should be able to get the channel ban removed when they type
!Unban nick/hostmask.


For example:

If the user joined is banned in #Channel1. When he joins the #Channel2{Helpchannel) Seeking for help.. The ops should be able to unban the ban through bot.. by typing !Unban nick/hostmask.

But the ops cannot be added to bots access list.

A simple public command will do. :)

!unban nick/hostmask.

The Bot should unban .. and notify in the channel mains.. the ban is removed.

Rgds

Skipper
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

why not have the ops on #Channel1 unban poor peon?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

This should do your job.

Code: Select all

#Set the channel for this script to unban on.
set channel1 "#channel1"

#Set the channel for this script to trigger on.
set channel2 "#channel2"


bind pub - "!unban" unban:mask

proc unban:mask {nick uhost hand chan text} {
 global channel1 channel2
  if {![botonchan $channel1] || ![botonchan $channel2]} {return 0}
  if {[string equal "" [lindex $text 0]]} {
   putquick "PRIVMSG $channel2 :Usage: !unban <nick!ident@host.domain.com> -- wilcards are accepted."; return 0
  }
  if {![ischanban [lindex $text 0] $channel1]} { 
   putquick "PRIVMSG $channel2 :The ban [lindex $text 0] does not exist or is placed on channel $channel1."; return 0
  }
  if {[botisop $channel1] && [isop $nick $channel2] && [string equal -nocase $chan $channel2]} {
   putquick "MODE $channel1 -b [lindex $text 0]"
   putquick "PRIVMSG $channel2 :The ban [lindex $text 0] has been successfully removed from channel $channel1."; return 0
   }
}
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

so goober joins the help chan and cries "help! I'm banned on main chan", then some op types !unban *!goober@* but guess what? there is no such ban on the main chan, goober is banned as goober!*@foo.bar.com

delegating channel handling from one place to another is, IMO, pointless
S
Skipper
Voice
Posts: 29
Joined: Sun Aug 21, 2005 10:00 am

Post by Skipper »

Hello awyeah,

Thanks for the script :)

But i guess as demond pointed out.. this script wont unban the matching ones..

example :- a nick called x` got banned.. with his ip. this script will unban
if we type !unban *!*@ip .. then only it will unban.. But how to alter .. it like.. !unban x` .. then the bans matching to x` should be unbanned.

Rgds

Skipper
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

That script was only a simple demonstration of a public command for !unban. For that we need a bit advanced script. First you put the users nickname: !unban <nickname>

The script will /whois or /who that user and get his nick!ident@host.domain.com. Then it will search through #channel1's ban list searching for any bans matching that mask: ident@host.domain.com. When one is found it will be unbanned and removed. Alternatively if that nick is not online, then the script will halt.

However if a banmask like *!*@* or *!*@*.* is placed in the banmask list of #channel1, i.e. masks affecting very large ranges, then they would match anything and they would be removed. If no matching mask is found the script will give a reply, saying that no match was found. I don't have time to implement this script at the moment, but you can try the scripts request section on this forum -- maybe someone can assist you.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

This should do it

Code: Select all

set helpchan #chan1
set mainchan #chan2

bind pub - !unban remove:ban

proc remove:ban {nick uhost hand chan arg} {
 global mainchan helpchan
 if {![string equal -nocase $helpchan $chan] && ![isop $nick $chan]} {return 0}
 set mask [lindex [split $arg] 0]
 foreach ban [chanbans $mainchan] {
  if {[string match -nocase $mask [lindex $ban 0]]} {
   pushmode $mainchan -b [lindex $ban 0]
   puthelp "privmsg $chan :Removed [lindex $ban 0] from the banlist of $mainchan."
   break
  }
 }
}
syntax: !unban nick!identd@host
S
Skipper
Voice
Posts: 29
Joined: Sun Aug 21, 2005 10:00 am

Post by Skipper »

Hello Sir Fz,

Will this script unbans if we type just !unban nick ? I mean wil it unban the matching bans with respect to the nick.. whatever the ban it is.. like either nick ban or ident ban or ip ban or subnet ban.. will it match the bans with respect to the nick?

Rgds

Skipper
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Sir_Fz wrote:This should do it

Code: Select all

set helpchan #chan1
set mainchan #chan2

bind pub - !unban remove:ban

proc remove:ban {nick uhost hand chan arg} {
 global mainchan helpchan
 if {![string equal -nocase $helpchan $chan] && ![isop $nick $chan]} {return 0}
 set mask [lindex [split $arg] 0]
 foreach ban [chanbans $mainchan] {
  if {[string match -nocase $mask [lindex $ban 0]]} {
   pushmode $mainchan -b [lindex $ban 0]
   puthelp "privmsg $chan :Removed [lindex $ban 0] from the banlist of $mainchan."
   break
  }
 }
}
syntax: !unban nick!identd@host
Actually Sir_Fz I don't think you fully understood what he mean't. He said that !unban <nickname> would look up a users host somehow (WHOIS most probobaly for which you need a definate bind raw) since we cannot use getchanhost or any other command as that nick won't be in the channel since he/she is banned and most likely kicked too. Upon getting the users host, try matching it with the channels banlist and remove all bans which affect that user. So if you read the explanation of my idea, maybe you will know how to implement it -- or maybe you have a different way
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Actually we can use getchanhost since nick is already in the helpchan (I dont know why I didn't think about this before)

This should do it Skipper.

Code: Select all

set helpchan #chan1 
set mainchan #chan2 

bind pub - !unban remove:ban 

proc remove:ban {nick uhost hand chan arg} { 
 global mainchan helpchan 
 if {![string equal -nocase $helpchan $chan] && ![isop $nick $chan]} {return 0} 
 if {![onchan [set n [lindex [split $arg] 0]] $chan]} {
  puthelp "privmsg $chan :$n is not here."
 } {
  set mask $n![getchanhost $n $chan] 
  foreach ban [chanbans $mainchan] { 
   if {[string match -nocase $mask [lindex $ban 0]]} { 
    pushmode $mainchan -b [lindex $ban 0] 
    puthelp "privmsg $chan :Removed [lindex $ban 0] from the banlist of $mainchan." 
    break 
   } 
  } 
 }
}
S
Skipper
Voice
Posts: 29
Joined: Sun Aug 21, 2005 10:00 am

Post by Skipper »

Hello Sir Fz,

No response from the bot when i type !unban Nick.

And Am not getting any error messages in the partyline of the bot.. wonder whats wrong.. and where it is wrong.


Rgds

Skipper
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Try

Code: Select all

set helpchan #chan1 
set mainchan #chan2 

bind pub - !unban remove:ban 

proc remove:ban {nick uhost hand chan arg} { 
 global mainchan helpchan 
 if {![string equal -nocase $helpchan $chan]} {return 0} 
 if {[isop $nick $chan] && [onchan [set n [lindex [split $arg] 0]] $chan]} { 
  set mask $n![getchanhost $n $chan] 
  foreach ban [chanbans $mainchan] { 
   if {[string match -nocase [lindex $ban 0] $mask]} { 
    set fb [lindex $ban 0] 
    break 
   } 
  }
  if {[info exists fb]} {
   if {[botisop $mainchan]} {
    pushmode $mainchan -b $fb
    puthelp "privmsg $chan :Removed $fb from $mainchan."
   } else {
    puthelp "privmsg $chan :I'm not oped on $mainchan."
   }
  } else {
   puthelp "privmsg $chan :$n is not banned on $mainchan."
  }
 }  
}
Note that you have to be oped in the helpchan when issuing the !unban command, and nick should be in it as well (also !unban only works in the helpchan to remove bans from mainchan)
S
Skipper
Voice
Posts: 29
Joined: Sun Aug 21, 2005 10:00 am

Post by Skipper »

Hello Sir Fz,

You ROCK :-)

The codes which u had given works PERFECT :)

Is it possible to record the kicks and bans happening in the channel.. and save it in a file.. and get the infos later on .. when we type !banfind nick.. so that the bot can get the info from that file.. as to who kicked or who banned and for what reason.. just like how seenbot works.. when we type !seen nick.. it will gives the info abt the nick when last joined or last quit.. etc etc. Likewise i would like to get the infos abt who kicked the nick .. or who banned and for what reason.

It will be a helpful script if it is possible to make one. :)


Rgds

Skipper
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

there ought to be some limit on begging for scripts, you know
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

getchanhost doesn't require a channel.
So if you just use getchanhost $nick it will return the host if it knows that host.
Post Reply