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 

enforcebans kicker with timer

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Mon Jan 03, 2022 2:35 pm    Post subject: enforcebans kicker with timer Reply with quote

i was trying out this enforce bans code

and was wondering how to edit it to have banned users kicked out but with a timer
and to have it check afterwards if the banned nick is actually still on channel and perhaps if multiple nicks have been banned within short period to send it with just a single timer to prevent a bunch of timers do to the same job on multiple nicks


Code:
bind mode - "* +b" enforcebansq
 
proc enforcebansq {nick uhost hand chan mc ban} {
  if {![string match -nocase [string map {"\\" "\\\\" "\[" "\\["} $ban] $::botname]} {
    foreach n [chanlist $chan] {
      if {[string match -nocase [string map {"\\" "\\\\" "\[" "\\["} $ban] $n![getchanhost $n $chan]]} {
       if {![isop $n $chan] && ![ishalfop $n $chan] && ![matchattr $hand o|o $chan]} { after [expr {5*1000*1}] [list checkenforceq $chan $n] }
      }
    }
  } else {
       return
  }
}

   proc checkenforceq {chan nick} {
   if {[onchan $nick $chan]} {
      putserv "kick $chan $nick :PLease follow our rules terms and conditions of our network thank you for more info use: /rules"
    } else { return }
}
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Mon Jan 10, 2022 9:43 am    Post subject: Reply with quote

actually we use this :

Code:

namespace eval enforceBans {

   set enforce(max) "4"

   set enforce(reason) "Ban %ban set in %from matches your host. You are banned!"
 
   bind mode - "% +b" [namespace current]::enforce

   proc enforce {nick uhost hand chan mc ban} {
      variable enforce
      set reason [string map [list "%from" $chan "%ban" $ban "%who" $nick] $enforce(reason)]
      if {![botisop $chan]} { return 0 }
      set ban [string map {"\\" "\\\\" "\[" "\\["} $ban]
       if {[matchstr "*@*mibbit*" "$ban"]} { return 0 }
       if {[string match -nocase $ban $::botname]} { return }
         foreach n [chanlist $chan] {
            if {![matchaddr $ban $n![getchanhost $n $chan]]} continue
            if {[isop $n $chan] || [ishalfop $n $chan] || [matchattr [nick2hand $n] "fnmo|fnmo" $chan]} continue
          if {[onchan $n $chan]} { lappend kickList($chan) $n }
         }
      if {[llength $kickList($chan)]  > 2} { return }
         if {[info exists kickList($chan)]} {
         set kickList($chan) [lsort -dictionary $kickList($chan)]
            set len [llength $kickList($chan)]
            while {$len > 0} {
               if {$len > $enforce(max)} {
                  set users [join [lrange $kickList($chan) 0 [expr {$enforce(max) - 1}]] ,]
                  set kickList($chan) [lrange $kickList($chan) $enforce(max) end]
                  incr len -$enforce(max)
               } else {
                  set users [join $kickList($chan) ,]
                  set len 0
               }
             after [expr {2*1000*1}] [list putnow "kick $chan $users $reason"]
            }
         }
      }
   }


i was wondering how to send the stored nicks to be kicked in this line

Quote:
after [expr {2*1000*1}] [list putnow "kick $chan $users $reason"]


to perhaps check if they are still online before kicking to make sure its not kicking out nicks that already have been kicked out or left channel
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Mon Jan 10, 2022 10:10 am    Post subject: Reply with quote

oh i actually found the pasted code odly doesnt stack the kicks
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 -> Scripting Help 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