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.

ident ban instead of hostban if irccloud user

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
S
Stefano1990
Voice
Posts: 25
Joined: Mon Jun 04, 2018 10:07 am
Contact:

Hello

Post by Stefano1990 »

now i check it the problem , can't use non-numeric string as operand of "*"
only timed doesnt work, without timed ban works fine
Use your common sense and try not to make me look too much like I know what I'm doing.
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

irccloud_kb.tcl v0.1

Post by SpiKe^^ »

Great. An error we can fix :)

Found a cut n paste error in three of my expressions.

Please check this next version.

..

Code: Select all

## >> irccloud_kb.tcl v0.1 << ##

################  Use the default kick reason:  Requested  ################
# !kb ted          :kick & ban ted  (this script doesn't remove this ban)
# !kb ted 20       :kick & ban ted  (remove ban in 20 minutes)
# !kb ted 20m      :kick & ban ted  (remove ban in 20 minutes)
# !kb ted 90s      :kick & ban ted  (remove ban in 90 seconds)
# !kb ted 4h       :kick & ban ted  (remove ban in 4 hours)
# !kb ted 1d       :kick & ban ted  (remove ban in 24 hours)

################  Use a custom kick reason  ################
# !kb ted Damn spammer   :kick & ban ted  (kick reason:  Damn spammer)
# !kb ted 20 stop that   :kick with reason: stop that (ban for 20 minutes)

################  Do just a kick, or just a ban  ################
# !k ted                :kick ted with default reason:  Requested
# !k ted Damn spammer   :kick ted with reason:  Damn spammer
# !b ted                :ban ted  (this script doesn't remove this ban)
# !b ted 1h             :ban ted  (remove this ban in 1 hour)



bind pub o|o !kb pubm:kickban
bind pub o|o !k pubm:kick
bind pub o|o !b pubm:ban

proc pubm:kick {nick host hand chan text} {
  pubm:kickban $nick $host $hand $chan $text k Kick
}
proc pubm:ban {nick host hand chan text} {
  pubm:kickban $nick $host $hand $chan $text b Ban
}


proc pubm:kickban {nick host hand chan text {do kb} {say "Kick and Ban"} } {
  set text [split [string trim $text]]
  if {![llength $text]} {
    puthelp "NOTICE $nick :Must provide a target nick to $say."
    return 0
  }
  set text [lassign $text whom]
  if {[isbotnick $whom] || ![botisop $chan] || [matchattr [nick2hand $whom $chan] mn]} {
    return 0
  }
  if {[set chost [getchanhost $whom $chan]] eq ""} { 
    puthelp "NOTICE $nick :$whom is not on $chan" 
    return 0
  }
  append say " $whom"

  if {[string match *b $do]} {
    if {[string match "*.irccloud.com" $chost]} {
      set mask *![lindex [split $chost @] 0]@*
    } else {  set mask [maskhost "$whom!$chost" 2]  }

    append say " ($mask"
    if {[llength $text]} {
      set rest [lassign $text exp]
      if {[regexp {^([1-9][0-9]{0,3})([smhd]?)$} $exp - num dur]} {
        if {$dur eq ""} {  set dur m  }

        set tcall [list timed:unban $mask $chan $nick $num $dur]
        if {$dur eq "d"} {  timer [expr {$num * 1440}] $tcall
        } elseif {$dur eq "h"} {  timer [expr {$num * 60}] $tcall
        } elseif {$dur eq "s"} {  utimer $num $tcall
        } else {  utimer [expr {$num * 60}] $tcall  }

        append say " for $num$dur"
        set text $rest
      }
    }
    append say ")"
  }

  if {[string match k* $do]} {  set reason "Requested"
    if {[llength $text]} {  set reason [join $text]  }
    append say " --> With Reason: $reason"
  }

  putquick "NOTICE $nick :$say"

  if {[string match *b $do]} {  putserv "MODE $chan +b $mask"  }
  if {[string match k* $do]} {  putserv "KICK $chan $whom :$reason"  }
}


proc timed:unban {mask chan nick num dur} {
  if {[botisop $chan] && [ischanban $mask $chan]} {
    putserv "MODE $chan -b $mask"
  }
}

putlog "irccloud_kb.tcl v0.1 Loaded."

SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
s
simo
Revered One
Posts: 1078
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

tested and seems to work fine

nice work SpiKe^^
Post Reply