egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

!sry to unban and reinvite the last banned user

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
bro0
Voice


Joined: 01 Apr 2009
Posts: 10

PostPosted: Sun Jun 21, 2009 7:37 pm    Post subject: !sry to unban and reinvite the last banned user Reply with quote

hi all (:

it would be great if there is a script which has a function like '!sry'.. if a script of the eggdrop worked wrongly or what ever.. and to reinvite the last kicked user / banned user (and unban him)..
.. in the last 5 minutes (!?)

and the command should be available for voice (and surly opped) users only.. =p


i hope thats a good idea and there is a scripter who also think so :p
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Sun Jul 26, 2009 3:59 pm    Post subject: Reply with quote

Code:
##
# SCRIPT
##

proc sorry:kick {nick host handle channel target reason} {
 global sorry
 if {![isbotnick $target]} {
  set target-host "$target![getchanhost $target]"
  set sorry($channel) "kick,$target,${target-host},[clock seconds],$reason"
  set sorry(kick:$channel) "$target,${target-host},[clock seconds],$reason"
  putloglev 1 * "sorry.tcl: added kick on $channel for '${target-host}' ($reason)"
  return
 }
}

proc sorry:mode {nick host handle channel mode target} {
 global sorry
 set target-nick [findnicks "$target" "$channel"]
 if {(${target-nick} != "") && (![isbotnick ${target-nick}])} {
  set target-host "${target-nick}![getchanhost ${target-nick}]"
  set sorry($channel) "ban,{$target-nick},${target-host},$target,[clock seconds],$nick"
  set sorry(ban:$channel) "${target-nick},${target-host},$target,[clock seconds],$nick"
  putloglev 1 * "sorry.tcl: added ban on $channel for '${target-host}' ($target)"
  return
 }
}

proc sorry:raw {from key text} {
 global sorry
 set _target [lindex [split $text] 1]
 if {[info exists sorry(invite:$_target)]} {
  puthelp "PRIVMSG $sorry(invite:$_target) :\001ACTION detected that $_target has left\001"
  putloglev 1 * "sorry.tcl: recived 401 from server, invite of $_target to $sorry(invite:$_target) has failed."
  return
 }
}

proc sorry:pub {nick host handle channel text} {
 global sorry
 if {![info exists sorry($channel)]} {
  puthelp "NOTICE $nick :Sorry, i have not been able to detect any kicks or bans in $channel"
  return 0
 }
 if {[llength $text] == 0} {
  regsub -all "," "$sorry($channel)" " " string
  switch -- [lindex $string 0] {
   "kick" {
           set a [lindex $string 1]; set b [lindex $string 3]; set c [join [lrange $string 4 end]]
           puthelp "NOTICE $nick :inviting $a to $channel after being kicked [duration [expr {[clock seconds]-$b}]] ago for $c"
           set sorry(invite:$a) "$channel"
           puthelp "INVITE $a $channel"
           return 1
          }
   "ban" {
          set a [lindex $string 1]; set b [lindex $string 3]; set c [lindex $string 4]; set d [lindex $string 5]
          puthelp "NOTICE $nick :inviting $a to $channel after being banned by $b [duration [expr {[clock seconds]-$c}]] ago by $d"
          if {[sorryBAN "$b" "$channel"]} {
           set sorry(invite:$a) "$channel"
           putserv "INVITE $a $channel"
           return 1
          } else {
           puthelp "NOTICE $nick :unable to remove the ban $b"
           return 0
          }
         }
  }
 }
 switch -- [lindex $text 0] {
  "-kick" {
           if {[info exists sorry(kick:$channel)]} {
            regsub -all "," "$sorry(kick:$channel)" " " string
            set _nick [lindex $string 0]; set _ktime [lindex $string 2]; set _kwhy [join [lrange $string 3 end]]
            puthelp "NOTICE $nick :Inviting $_nick to $channel after being kicked [duration [expr {[clock seconds]-$_ktime}]] ago for $_kwhy"
            set sorry(invite:$_nick) "$channel"
            putserv "INVITE $_nick $channel"
            return 1
           } else {
            puthelp "NOTICE $nick :I was unable to detect the last kick on $channel, sorry."
            return 0
           }
          }
  "-ban" {
          if {[info exists sorry(ban:$channel)]} {
           regsub -all "," "$sorry(ban:$channel)" " " string
           set _nick [lindex $string 0]; set _btime [lindex $string 3]; set _bmask [lindex $string 2]; set _bby [lindex $string 4]
           puthelp "NOTICE $nick :Inviting $_nick to $channel after they have been banned by $_bmask [duration [expr {[clock seconds]-$_btime}]] ago by $_bby"
           if {[sorryBAN "$_bmask" "$channel"]} {
            set sorry(invite:$_nick) "$channel"
            putserv "INVITE $_nick $channel"
            return 1
           } else {
            puthelp "NOTICE $nick :sorry, i have not been able to remove the ban $_bmask. You try removing it!"
            return 0
           }
          } else {
           puthelp "NOTICE $nick :I was unable to detect the last ban on $channel, sorry."
           return 0
          }
         }
  default {
           puthelp "NOTICE $nick :Syntax: \002!sorry\002 <-kick/-ban>"
           puthelp "NOTICE $nick :Removes the last kick or ban and invites the user to join the channel"
           puthelp "NOTICE $nick :if you use the \002-kick\002 option, only the last user kicked will be invited"
           puthelp "NOTICE $nick :if you use the \002-ban\002 option, only the last user banned will be invited"
           return 1
          }
 }
}

proc sorryBAN {host channel} {
 if {[isban "$host"]} {
  if {[killban "$host"]} {
   return 1
  } else {
   return 0
  }
 } elseif {[isban "$host" "$channel"]} {
  if {[killchanban "$channel" "$host"]} {
   return 1
  } else {
   return 0
  }
 } elseif {[ischanban "$host" "$channel"]} {
  pushmode $channel -b $host
  return 1
 } else {
  # we are just going to assume its been removed by someone else
  return 1
 }
}

 bind pub o|o !sorry sorry:pub
 bind raw - 401 sorry:raw
 bind mode - "*+b*" sorry:mode
 bind kick - "*" sorry:kick
 putlog "loaded sorry.tcl version 1.0(b) by TCL_no_TK"
 return
tested, and it works ok Smile could be betta Wink
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
bro0
Voice


Joined: 01 Apr 2009
Posts: 10

PostPosted: Tue Jul 28, 2009 9:38 pm    Post subject: Reply with quote

big thanks, great work Smile
<3
Back to top
View user's profile Send private message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Tue Oct 27, 2009 4:00 pm    Post subject: Reply with quote

Code:
<Modo> [19:57] Tcl error [sorry:mode]: invalid command name "findnicks"


What is the error?
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Thu Oct 29, 2009 6:28 pm    Post subject: Reply with quote

You didn't install MC_8's More Tools TCL Script Exclamation
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber