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 

script checker for webuser and ssl on join

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


Joined: 29 Apr 2022
Posts: 5

PostPosted: Mon May 16, 2022 9:38 am    Post subject: script checker for webuser and ssl on join Reply with quote

If is possible 1 script to match on join user who are not connected with SSL and via WEBIRC to set channel mode +RN {timemode} 5m and kickban all users on join also exempt host or ip of irccloude (*.irccloud.com} with swois raw 671 for SSL, and raw 320 for via WEBIRC, raw 311 nick!iden@host:realname , and raw 318 for End of /WHOIS list
also channel target and option for kick and ban 0/1 to make only ban or only kick after channel mode is set +RN

If the user dont have 1 of this info {*Secure or *WEBIRC*} to set mode channel +RN and ban & kick reason: Sorry , Try To Connect from Website

ty in advance


example :

Code:


User swhois is connecting via WEBIRC

User is using a Secure Connection (SSL)

Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 859

PostPosted: Mon May 16, 2022 1:00 pm    Post subject: Reply with quote

depending on network you could use channel modes for that for example
InspIRCd-3 and UnrealIRCd-6 have channel modes for that if certain modules are loaded
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 770
Location: Tennessee, USA

PostPosted: Tue May 17, 2022 10:48 am    Post subject: whos.tcl ver 0.1 Reply with quote

Spartan,

This is the way I see that script request...

Script checks everyone joining the channel, see if they should be allowed to stay.

A trusted nick must meet at least one of these tests:

1) handle has any exempt flags
2) user matches an exempt hostmasks

- if still not a trusted nick, /whois nick...
3) is using a secure connection
4) is connecting via webirc


All other nicks are now judged as not trusted and could be ban/kicked?


Here's a script along those lines...
Code:

#### whos.tcl ver 0.1 (17May2022) ####

namespace eval whos {   variable whos

##### begin settings #####


# Channel(s) where bot to check on joins OR set to {*} for all channels
set whos(chans) {*}

# Exempt:  hostmask(s) to not check on join
set whos(xmasks) {*!*@*.irccloud.com *!*@*.mibbit.com}

# Exempt:  flag(s) to not check on join
set whos(xflags) "bfmno|bfmno"


# Bans:  set channel ban(s) on the offenders??  (0 = no || 1 = yes)
set whos(dobans) 0

# Bans:  set the type of banmask to use
# 0 =  *!user@host
# 1 =  *!*user@host
# 2 =  *!*@host
# 3 =  *!*user@*.host
# 4 =  *!*@*.host
set whos(masktype) 2

# Bans:  set ban time in minutes
#   0 = this script doesn't remove these bans
set whos(bantime) 5


# Kicks:  kick offenders from the channels??  (0 = no || 1 = yes)
set whos(dokick) 0

# Kicks:  set a custom reason to use when kicking offenders
set whos(reason) ""


# Modes:  channel modes to set when an offender joins the channel??
set whos(domode) "+RN"

# Modes:  remove the above channel modes after how many minutes?
#   0 = this script doesn't remove these modes
set whos(modetime) 2


###### end settings ######

setudef flag [set whos(udflag) [string trim [namespace current] ":"]]

set whos(chans) [split [string tolower [string trim $whos(chans)]]]
set whos(xmasks) [split [string trim $whos(xmasks)]]
set whos(xflags) [string trim $whos(xflags)]


if {$whos(bantime) > 0} {  set whos(bantime) [expr {$whos(bantime) * 60}]  }
set whos(reason) [string trim $whos(reason)]

set whos(domode) [string trim $whos(domode)]
if {$whos(domode) ne ""} {
  if {![string match {[-+]?*} $whos(domode)]} { set whos(domode) +$whos(domode) }
  if {$whos(modetime)>0} { set whos(unmode) [string map {+ - - +} $whos(domode)] }
}
if {$whos(modetime) > 0} { set whos(modetime) [expr {$whos(modetime) * 60}] }


############

bind join - * [namespace current]::onjoin

proc onjoin {nk uh hn ch} {
  if {[isbotnick $nk]} {  return 0  }  ;# this Bot is Exempt from this script #
  variable whos
  putlog "proc onjoin : nk=($nk) uh=($uh) hn=($hn) ch=($ch)"

  if {$hn ne "*" && $whos(xflags) ne ""} {   ;# check if handle has any Exempt Flags #
    if {[matchattr $hn $whos(xflags) $ch]} {  return 0  }
  }
  set c [string tolower $ch]  ;  set validch 0     ;# check if is in a Valid Channel #
  if {[channel get $ch $whos(udflag)]} {  set validch 1  }
  if {$whos(chans) eq "*" || $c in $whos(chans)} {  set validch 1  }
  if {$validch == 0} {  return 0  }

  foreach xmask $whos(xmasks) {               ;# check if matches an Exempt Hostmask #
    if {[matchaddr $xmask ${nk}!$uh]} {  return 0  }
  }

  set n [string tolower $nk]  ;  set now [clock milliseconds]
  set id "${c},$n"
  set joininfo [dict create ms $now nik $nk uho $uh hnd $hn cha $ch]

  if {![info exists whos(joinque)]} {
    set whos(joinque) [dict create $id $joininfo]
    putlog "   sent1:  WHOIS $nk ..."                        ;# <<== #################
    putserv "WHOIS $nk"  ;  return 0
  }
  ####


  set jqlist [dict keys $whos(joinque) "*,$n"]

  if {![llength $jqlist]} {
    dict set whos(joinque) $id $joininfo
    putlog "   sent2:  WHOIS $nk ..."                        ;# <<== #################
    putserv "WHOIS $nk"  ;  return 0
  }

  if {$id in $jqlist} {
    ## Do something, maybe?   #channel,nick  :already in $whos(joinque) ##
    return 0
  }

  dict set whos(joinque) $id $joininfo
  ####


  return 0
}  ;# end: proc onjoin



############

bind raw - 311 [namespace current]::onraw   ;# "rname (realname)"
bind raw - 671 [namespace current]::onraw   ;# "secure"
bind raw - 320 [namespace current]::onraw   ;# "country & webirc"
bind raw - 318 [namespace current]::onraw   ;# "done"


proc onraw {from num txt} {
  putlog "=> proc onraw : from=($from) num=($num) txt=($txt)"
  variable whos
  if {![info exists whos(joinque)]} {  return 0  }

  set tx [join [lassign [split $txt] bot target]]
  set tgt [string tolower $target]
  set jqlist [dict keys $whos(joinque) "*,$tgt"]

  if {![llength $jqlist]} {  return 0  }
  set key [lindex $jqlist 0]

  if {$num == 311} {     ;# "rname (realname)"      #######
    set rname [join [lassign [split $tx] user host astr]]
    if {$astr eq "*" && [string index $rname 0] eq ":"} {
      set rname [string range $rname 1 end]
      dict set whos(joinque) $key rname $rname

      #putlog "   realname: $rname"                        ;# <<== #################
    }
    return 0
  }

  if {$num == 671} {               ;# "secure"      #######
    if {[matchstr ":is using a Secure Connection*" $tx]} {
      dict set whos(joinque) $key secure 1
    }
    return 0
  }

  if {$num == 320} {     ;# "country & webirc"      #######
    if {[regexp {^:connected from (.+)$} $tx - country]} {
      dict set whos(joinque) $key country $country

      #putlog "   country: $country"                        ;# <<== #################
    }

    if {[matchstr ":is connecting via WEBIRC" $tx]} {
      dict set whos(joinque) $key webirc 1
    }
    return 0
  }

  if {$num == 318} {                 ;# "done"      #######
    if {[matchstr ":End of /WHOIS list." $tx]} {

      set isSecure 0  ;  set isWebirc 0  ;  set isOk 0
      if {[dict exists $whos(joinque) $key secure]} {  set isSecure 1  }
      if {[dict exists $whos(joinque) $key webirc]} {  set isWebirc 1  }
      if {$isSecure==1 || $isWebirc==1} {  set isOk 1  }


      foreach key $jqlist {   set ch [dict get $whos(joinque) $key cha]
        lappend cls $ch
      }


      if {$isOk==1} {  ;# Is connected by secure and/or by webirc #
        if {$isSecure==1 && $isWebirc==1} {
        putlog "   > IS connected Both Secure And Webirc!  $target is allowed in: [join $cls]"
        } elseif {$isSecure==1} {
        putlog "   > Is using a Secure Connection.  $target is allowed in: [join $cls]"
        } else { putlog "   > Is connecting via WEBIRC.  $target is allowed in: [join $cls]" }

      } else {    ;# Else is Not connected by secure or by webirc #
        putlog "   > NOT connected Secure or by Webirc!  KickBan $target in: [join $cls]"


        if {$whos(domode) ne ""} {     ;# Set channel modes      #######
          foreach ch $cls {   putquick "MODE $ch $whos(domode)"
            if {$whos(modetime)>0} {
              utimer $whos(modetime) [list putquick "MODE $ch $whos(unmode)"]
            }
          }
        }
                                        ;# Set channel bans      #######
        if {$whos(dobans)==1} {   set uho [dict get $whos(joinque) $key uho]
          set bmask [maskhost "${target}!$uho" $whos(masktype)]
          foreach ch $cls {   pushmode $ch +b $bmask
            if {$whos(bantime)>0} {
              utimer $whos(bantime) [list pushmode $ch -b $bmask]
            }
          }
        }

        if {$whos(dokick)==1} {   ;# Kick nicks from channel     #######
          foreach ch $cls {
            if {$whos(reason) eq ""} {  putkick $ch $target
            } else {  putkick $ch $target $whos(reason)  }
          }
        }


      }    ;#  END:  Else is Not connected by secure or by webirc #


      if {[llength $jqlist]>=[dict size $whos(joinque)]} {  unset whos(joinque)
      } else {  set whos(joinque) [dict remove $whos(joinque) {*}$jqlist]  }

    }
  }  ;# end if 318 #

  return 0
}  ;# end: proc onraw



}  ;## end of:  namespace eval whos ##

putlog "whos.tcl ver 0.1 Loaded."




Check it out and let me know
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
Spartan
Voice


Joined: 29 Apr 2022
Posts: 5

PostPosted: Tue May 17, 2022 12:25 pm    Post subject: Hi Reply with quote

Spike^^ script is work great no errors but have 1 thing is kick before set ban and when is join 3 users is not set 3 ban in 1 line


ty again great code

1 user on join matched

Code:

[19:06:14] * Joins: PAPPU (houezy@94DD7E6E.8E52E284.A6A01F07.IP
[19:06:14] * X sets mode: +NR
[19:06:15] * PAPPU was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:06:15] * X sets mode: +b *!*@94DD7E6E.8E52E284.A6A01F07.IP


need to be in this order way i think

Code:

[19:06:14] * Joins: PAPPU (houezy@94DD7E6E.8E52E284.A6A01F07.IP
[19:06:14] * X sets mode: +NR
[19:06:15] * X sets mode: +b *!*@94DD7E6E.8E52E284.A6A01F07.IP
[19:06:15] * PAPPU was kicked from #test by X (Sorry, Try to connect via WEBIRC)



3 user on join matched

Code:

[19:09:44] * Joins: PRISHU (ecifkg@526E5BBD.43F5E76B.D86B19F6.IP)
[19:09:44] * Joins: CHIKOO (yarqkj@D90CA7AB.14C531F4.C64C234B.IP)
[19:09:44] * Joins: GUDIYA (aasdqu@8BF03232.C88719AD.322F620B.IP) 
[19:09:45] * PRISHU was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:09:45] * X sets mode: +b *!*@526E5BBD.43F5E76B.D86B19F6.IP
[19:09:45] * CHIKOO was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:09:45] * X sets mode: +b *!*@D90CA7AB.14C531F4.C64C234B.IP
[19:09:45] * GUDIYA was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:09:45] * X sets mode: +b *!*@8BF03232.C88719AD.322F620B.IP



also here need to be in this order way

Code:

[19:09:44] * Joins: PRISHU (ecifkg@526E5BBD.43F5E76B.D86B19F6.IP)
[19:09:44] * Joins: CHIKOO (yarqkj@D90CA7AB.14C531F4.C64C234B.IP)
[19:09:44] * Joins: GUDIYA (aasdqu@8BF03232.C88719AD.322F620B.IP)
[19:09:45] * X sets mode: +bbb *!*@8BF03232.C88719AD.322F620B.IP *!*@D90CA7AB.14C531F4.C64C234B.IP *!*@526E5BBD.43F5E76B.D86B19F6.IP
[19:09:45] * PRISHU was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:09:45] * CHIKOO was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:09:45] * GUDIYA was kicked from #test by X (Sorry, Try to connect via WEBIRC)


Is possible to make the ban first after the kick and also when is match more from 1 nick on join to set all bans in 1 line ?
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 770
Location: Tennessee, USA

PostPosted: Sun May 22, 2022 10:39 am    Post subject: whos.tcl ver 0.2 Reply with quote

Spartan,

This version tries to address both of your issues with how the script is handling bans and kicks.
=> Check out the 2 new custom queue settings!

Please test and see if this is better.

Code:


####  whos.tcl ver 0.2  by SpiKe^^  (21May2022)  ####

namespace eval whos {   variable whos

##### begin settings #####


# Channel(s) where bot to check on joins OR set to {*} for all channels
#     Example:  set whos(chans) {#channel1 #channel2}
#  Note: or set empty to Add Channels using:  .chanset <chan> +whos
set whos(chans) {*}

# Exempt:  hostmask(s) to not check on join
#   Note: set empty to disable any masks testing
set whos(xmasks) {*!*@*.irccloud.com *!*@*.mibbit.com}

# Exempt:  flag(s) to not check on join
#   Note: set empty to disable any flags testing
set whos(xflags) "bfmno|bfmno"


### punishment settings ###

# Bans:  set channel ban(s) on the offenders??  (0 = no || 1 = yes)
set whos(dobans) 0

# Bans:  set the type of banmask to use  (0 - 39)
#   Note: uses the eggdrop tcl command:  maskhost
#         see the other 35 masktype options at:
#   docs.eggheads.org/mainDocs/tcl-commands.html#maskhost-nick-user-host-masktype
# 0 =  *!user@host
# 1 =  *!*user@host
# 2 =  *!*@host
# 3 =  *!*user@*.host   (default)
# 4 =  *!*@*.host
set whos(masktype) 2

# Bans:  set ban time in minutes  (before this script will remove these bans)
#   0 = this script doesn't remove these bans
set whos(bantime) 5

# Bans:  max number of bans to stack in one mode command (1 - 10) #
set whos(maxban) 6


# Kicks:  kick offenders from the channels??  (0 = no || 1 = yes)
set whos(dokick) 0

# Kicks:  set a custom reason to use when kicking offenders
#   Note: set empty to not use a custom kick reason
set whos(reason) ""

# Kicks:  max number of kicks to stack in one kick command (1 - 12) #
set whos(maxkick) 3


# Modes:  channel modes to set when an offender joins the channel??
#   Note: set empty to not set any channel modes
set whos(domode) "+RN"

# Modes:  remove the above channel modes after how many minutes?
#   0 = this script doesn't remove these modes
set whos(modetime) 2


###### end settings ######

setudef flag [set whos(udflag) [string trim [namespace current] ":"]]

variable kbque

set whos(chans) [split [string tolower [string trim $whos(chans)]]]
set whos(xmasks) [split [string trim $whos(xmasks)]]
set whos(xflags) [string trim $whos(xflags)]

if {$whos(dobans) != 0} {  set whos(dobans) 1  }
if {![string is digit -strict $whos(masktype)] || $whos(masktype) > 39} {
  set whos(masktype) 3
}
if {![string is digit -strict $whos(bantime)]} {  set whos(bantime) 5
} elseif {$whos(bantime) > 720} {  set whos(bantime) 720  }
if {$whos(bantime) > 0} {  set whos(bantime) [expr {$whos(bantime) * 60}]  }

if {![string is digit -strict $whos(maxban)] || $whos(maxban)<1} {
  set whos(maxban) 6
} elseif {$whos(maxban) > 10} {  set whos(maxban) 10  }

if {$whos(dokick) != 0} {  set whos(dokick) 1  }
set whos(reason) [string trim $whos(reason)]
if {![string is digit -strict $whos(maxkick)] || $whos(maxkick)<1} {
  set whos(maxkick) 3
} elseif {$whos(maxkick) > 12} {  set whos(maxkick) 12  }

set whos(domode) [string trim $whos(domode)]
if {$whos(domode) ne ""} {
  if {![string match {[-+]?*} $whos(domode)]} { set whos(domode) +$whos(domode) }
  if {$whos(modetime)>0} { set whos(unmode) [string map {+ - - +} $whos(domode)] }
}

if {![string is digit -strict $whos(modetime)]} {  set whos(modetime) 2
} elseif {$whos(modetime) > 720} {  set whos(modetime) 720  }
if {$whos(modetime) > 0} { set whos(modetime) [expr {$whos(modetime) * 60}] }


############

bind join - * [namespace current]::onjoin

proc onjoin {nk uh hn ch} {
  if {[isbotnick $nk]} {  return 0  }  ;# this Bot is Exempt from this script #
  variable whos
  #putlog "proc onjoin : nk=($nk) uh=($uh) hn=($hn) ch=($ch)"

  if {$hn ne "*" && $whos(xflags) ne ""} {   ;# check if handle has any Exempt Flags #
    if {[matchattr $hn $whos(xflags) $ch]} {  return 0  }
  }
  set c [string tolower $ch]  ;  set validch 0     ;# check if is in a Valid Channel #
  if {[channel get $ch $whos(udflag)]} {  set validch 1  }
  if {$whos(chans) eq "*" || $c in $whos(chans)} {  set validch 1  }
  if {$validch == 0} {  return 0  }

  foreach xmask $whos(xmasks) {               ;# check if matches an Exempt Hostmask #
    if {[matchaddr $xmask ${nk}!$uh]} {  return 0  }
  }

  set n [string tolower $nk]  ;  set now [clock milliseconds]
  set id "${c},$n"
  set joininfo [dict create ms $now nik $nk uho $uh hnd $hn cha $ch]

  if {![info exists whos(joinque)]} {
    set whos(joinque) [dict create $id $joininfo]
    #putlog "   sent1:  WHOIS $nk ..."                        ;# <<== #################
    putserv "WHOIS $nk"  ;  return 0
  }
  ####


  set jqlist [dict keys $whos(joinque) "*,$n"]

  if {![llength $jqlist]} {
    dict set whos(joinque) $id $joininfo
    #putlog "   sent2:  WHOIS $nk ..."                        ;# <<== #################
    putserv "WHOIS $nk"  ;  return 0
  }

  if {$id in $jqlist} {
    ## Do something, maybe?   #channel,nick  :already in $whos(joinque) ##
    return 0
  }

  dict set whos(joinque) $id $joininfo
  ####


  return 0
}  ;# end: proc onjoin


############

bind raw - 311 [namespace current]::onraw   ;# "rname (realname)"
bind raw - 671 [namespace current]::onraw   ;# "secure"
bind raw - 320 [namespace current]::onraw   ;# "country & webirc"
bind raw - 318 [namespace current]::onraw   ;# "done"


proc onraw {from num txt} {
  #putlog "=> proc onraw : from=($from) num=($num) txt=($txt)"
  variable whos  ;  variable kbque
  if {![info exists whos(joinque)]} {  return 0  }

  set tx [join [lassign [split $txt] bot target]]
  set tgt [string tolower $target]
  set jqlist [dict keys $whos(joinque) "*,$tgt"]

  if {![llength $jqlist]} {  return 0  }
  set key [lindex $jqlist 0]

  if {$num == 311} {     ;# "rname (realname)"      #######
  # from=(irc.Epikuri.com) num=(311) txt=(X debian Username Epikuri-1EF13586.access.hol.gr * :netedy)
    set rname [join [lassign [split $tx] user host astr]]
    if {$astr eq "*" && [string index $rname 0] eq ":"} {
      set rname [string range $rname 1 end]
      dict set whos(joinque) $key rname $rname

      #putlog "   realname: $rname"                        ;# <<== #################
    }
    return 0
  }

  if {$num == 671} {               ;# "secure"      #######
    # from=(irc.Epikuri.com) num=(671) txt=(X Debian :is using a Secure Connection)
    if {[matchstr ":is using a Secure Connection*" $tx]} {
      dict set whos(joinque) $key secure 1
    }
    return 0
  }

  if {$num == 320} {     ;# "country & webirc"      #######
    # from=(irc.Epikuri.com) num=(320) txt=(X RINI :connected from United States (US))
    if {[regexp {^:connected from (.+)$} $tx - country]} {
      dict set whos(joinque) $key country $country

      #putlog "   country: $country"                        ;# <<== #################
    }
    # from=(irc.Epikuri.com) num=(320) txt=(X Alb5422 :is connecting via WEBIRC)
    if {[matchstr ":is connecting via WEBIRC" $tx]} {
      dict set whos(joinque) $key webirc 1
    }
    return 0
  }

  if {$num == 318} {                 ;# "done"      #######
    # from=(irc.Epikuri.com) num=(318) txt=(X RINI :End of /WHOIS list.)
    if {[matchstr ":End of /WHOIS list." $tx]} {

      set isSecure 0  ;  set isWebirc 0  ;  set isOk 0
      if {[dict exists $whos(joinque) $key secure]} {  set isSecure 1  }
      if {[dict exists $whos(joinque) $key webirc]} {  set isWebirc 1  }
      if {$isSecure==1 || $isWebirc==1} {  set isOk 1  }

      foreach key $jqlist {   set ch [dict get $whos(joinque) $key cha]
        lappend cls $ch
      }


      if {$isOk==1} {  ;# Is connected by secure and/or by webirc #
        #if {$isSecure==1 && $isWebirc==1} {
        #putlog "   > IS connected Both Secure And Webirc!  $target is allowed in: [join $cls]"
        #} elseif {$isSecure==1} {
        #putlog "   > Is using a Secure Connection.  $target is allowed in: [join $cls]"
        #} else { putlog "   > Is connecting via WEBIRC.  $target is allowed in: [join $cls]" }

      } else {    ;# Else is Not connected by secure or by webirc #
        #putlog "   > NOT connected Secure or by Webirc!  KickBan $target in: [join $cls]"


        if {$whos(domode) ne ""} {     ;# Set channel modes      #######
          foreach ch $cls {   putquick "MODE $ch $whos(domode)"
            if {$whos(modetime)>0} {
              utimer $whos(modetime) [list putquick "MODE $ch $whos(unmode)"]
            }
          }
        }


########  if doing bans and/or kicks  ##
        if {$whos(dobans)==1 || $whos(dokick)==1} {
          if {$whos(dobans)==1} {  set uho [dict get $whos(joinque) $key uho]
            set bmask [maskhost "${target}!$uho" $whos(masktype)]
          } else {  set bmask "-"  }

          foreach ch $cls {   set c [string tolower $ch]

            if {![info exists kbque($c)]} {
              after 750 [list "[namespace current]::dokban" $c]  ;# <= que time
            }
            lappend kbque($c) "${tgt},$bmask"
          }
        }
########


      }    ;#  END:  Else is Not connected by secure or by webirc #


      if {[llength $jqlist]>=[dict size $whos(joinque)]} {  unset whos(joinque)
      } else {  set whos(joinque) [dict remove $whos(joinque) {*}$jqlist]  }

    }
  }  ;# end if 318 #

  return 0
}  ;# end: proc onraw



##################################

proc dokban {c} {
  variable whos  ;  variable kbque
  if {![info exists kbque($c)]} {  return 0  }
  foreach item $kbque($c) {  lassign [split $item ","] nk bmask
    if {$whos(dobans)==1 && $bmask ne "-"} {  lappend maskls $bmask  }
    if {$whos(dokick)==1} {  lappend nickls $nk  }
  }

  if {[info exists maskls]} {               ;######
    if {$whos(bantime)>0} {
      utimer $whos(bantime) [list "[namespace current]::undoban" $c $maskls]
    }

    saybans $c $maskls
  }

  if {[info exists nickls]} {               ;######
    while {[set len [llength $nickls]] > 0} {
      if {$len > $whos(maxkick)} {
        set nicks [join [lrange $nickls 0 [expr {$whos(maxkick) - 1}]] ","]
        set nickls [lrange $nickls $whos(maxkick) end]
      } else {
        set nicks [join $nickls ","]
        set nickls ""
      }
      if {$whos(reason) eq ""} {  putserv "KICK $c $nicks"
      } else {  putserv "KICK $c $nicks :$whos(reason)"  }
    }
  }

  unset kbque($c)
}  ;# end: proc dokban


############

proc undoban {c maskls} {   variable whos
  if {![botisop $c]} {  return 0  }

  foreach mask $maskls {
    if {[ischanban $mask $c]} {  lappend nowls $mask  }
  }
  if {[info exists nowls]} {  saybans $c $nowls "-"  }
}  ;# end: proc undoban


############

proc saybans {c maskls {sign +} } {   variable whos
  while {[set len [llength $maskls]] > 0} {
    if {$len > $whos(maxban)} {
      set mode [string repeat "b" $whos(maxban)]
      set masks [join [lrange $maskls 0 [expr {$whos(maxban) - 1}]]]
      set maskls [lrange $maskls $whos(maxban) end]
    } else {
      set mode [string repeat "b" $len]
      set masks [join $maskls]
      set maskls ""
    }
    putquick "MODE $c ${sign}$mode $masks"
  }
}  ;# end: proc saybans

############



}  ;## end of:  namespace eval whos ##

putlog "whos.tcl ver 0.2 Loaded."



_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
Spartan
Voice


Joined: 29 Apr 2022
Posts: 5

PostPosted: Sun May 22, 2022 12:23 pm    Post subject: Hi Reply with quote

Spike^^ ty again the scripts works great now and set mode channel and ban and kick in order also time ban and time mode is work great exact unset and unban all.

Spike^^ thx a lot a great fast script

Code:


[19:20:44] * Joins: gudiya (zmiitx@D2B89372.23EF34A4.322F620B.IP) 
[19:20:44] * Joins: kanha (bgich@D7FF18AC.ACDA578F.C64C234B.IP) 
[19:20:44] * Joins: shree (kzyvoh@39CE9ADB.6A1EB3FD.C64C234B.IP) 
[19:20:44] * Joins: coco (wlidc@2B559C8D.ACDA578F.C64C234B.IP) 
[19:20:44] * Joins: pihu (kcelejr@8BF03232.C88719AD.322F620B.IP) 
[19:20:45] * X sets mode: +bbbbb *!*@D2B89372.23EF34A4.322F620B.IP *!*@D7FF18AC.ACDA578F.C64C234B.IP *!*@39CE9ADB.6A1EB3FD.C64C234B.IP *!*@2B559C8D.ACDA578F.C64C234B.IP *!*@8BF03232.C88719AD.322F620B.IP
[19:20:45] * gudiya was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:20:45] * kanha was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:20:45] * shree was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:20:45] * coco was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:20:45] * pihu was kicked from #test by X (Sorry, Try to connect via WEBIRC)

[19:20:44] * Joins: gudiya (zmiitx@D2B89372.23EF34A4.322F620B.IP)
[19:20:44] * Joins: kanha (bgich@D7FF18AC.ACDA578F.C64C234B.IP)
[19:20:44] * Joins: shree (kzyvoh@39CE9ADB.6A1EB3FD.C64C234B.IP)
[19:20:44] * Joins: coco (wlidc@2B559C8D.ACDA578F.C64C234B.IP)
[19:20:44] * Joins: pihu (kcelejr@8BF03232.C88719AD.322F620B.IP)
[19:20:45] * X sets mode: +bbbbb *!*@D2B89372.23EF34A4.322F620B.IP *!*@D7FF18AC.ACDA578F.C64C234B.IP *!*@39CE9ADB.6A1EB3FD.C64C234B.IP *!*@2B559C8D.ACDA578F.C64C234B.IP *!*@8BF03232.C88719AD.322F620B.IP
[19:20:45] * gudiya was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:20:45] * kanha was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:20:45] * shree was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:20:45] * coco was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:20:45] * pihu was kicked from #test by X (Sorry, Try to connect via WEBIRC)

[19:19:43] * Joins: kanha (bgich@D7FF18AC.ACDA578F.C64C234B.IP)
[19:19:43] * Joins: pihu (kcelejr@8BF03232.C88719AD.322F620B.IP)
[19:19:44] * X sets mode: +NR
[19:19:44] * X sets mode: +bb *!*@D7FF18AC.ACDA578F.C64C234B.IP *!*@8BF03232.C88719AD.322F620B.IP
[19:19:44] * kanha was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:19:44] * pihu was kicked from #test by X (Sorry, Try to connect via WEBIRC)

[19:25:05] * Joins: gudiya (zmiitx@D2B89372.23EF34A4.322F620B.IP)
[19:25:05] * Joins: coco (wlidc@2B559C8D.ACDA578F.C64C234B.IP)
[19:25:05] * Joins: kanha (bgich@D7FF18AC.ACDA578F.C64C234B.IP)
[19:25:05] * X sets mode: +E
[19:25:06] * gudiya was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:25:06] * coco was kicked from #test by X (Sorry, Try to connect via WEBIRC)
[19:25:06] * kanha was kicked from #test by X (Sorry, Try to connect via WEBIRC)

[19:25:05] * Joins: gudiya (zmiitx@D2B89372.23EF34A4.322F620B.IP)
[19:25:05] * Joins: coco (wlidc@2B559C8D.ACDA578F.C64C234B.IP)
[19:25:05] * Joins: kanha (bgich@D7FF18AC.ACDA578F.C64C234B.IP)
[19:25:05] * X sets mode: +E
[19:25:06] * gudiya was kicked from #testing by X (Sorry, Try to connect via WEBIRC)
[19:25:06] * coco was kicked from #testing by X (Sorry, Try to connect via WEBIRC)
[19:25:06] * kanha was kicked from #testing by X (Sorry, Try to connect via WEBIRC)

[19:25:44] * X sets mode: -bbbbb *!*@D2B89372.23EF34A4.322F620B.IP *!*@D7FF18AC.ACDA578F.C64C234B.IP *!*@39CE9ADB.6A1EB3FD.C64C234B.IP *!*@2B559C8D.ACDA578F.C64C234B.IP *!*@8BF03232.C88719AD.322F620B.IP

[19:27:05] * X sets mode: -E

Back to top
View user's profile Send private message
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