<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/21232" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2023-01-10T16:43:00-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/21232</id>

		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2023-01-10T16:43:00-04:00</updated>

		<published>2023-01-10T16:43:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111613#p111613</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111613#p111613"/>
		<title type="html"><![CDATA[check if nick is still on channel before kicking]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111613#p111613"><![CDATA[
ive tested again and original code seems to work fine now SpiKe^^ thanks much apreciated<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Tue Jan 10, 2023 4:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2023-01-10T15:47:44-04:00</updated>

		<published>2023-01-10T15:47:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111611#p111611</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111611#p111611"/>
		<title type="html"><![CDATA[check if nick is still on channel before kicking]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111611#p111611"><![CDATA[
thanks for your reply caesar ive tried your suggestion as well and for some reason it doesnt seem to trigger and i didnt get any error in PL<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Tue Jan 10, 2023 3:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2023-01-10T12:49:05-04:00</updated>

		<published>2023-01-10T12:49:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111610#p111610</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111610#p111610"/>
		<title type="html"><![CDATA[check if nick is still on channel before kicking]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111610#p111610"><![CDATA[
If for whatever reason <em class="text-italics">lsort</em> doesn't work for you then try with <em class="text-italics">dict</em>, here's an example:<div class="codebox"><p>Code: </p><pre><code>foreach ele $myList {dict set tmp $ele myList}set unique [dict keys $tmp]</code></pre></div>I would switch back to the original 'enforce:kick' and use a helper function instead:<div class="codebox"><p>Code: </p><pre><code>proc filter:kick {chan} {if {![botisop $chan] || ![info exists kickList($chan)]} returnforeach ele $kickList($chan) {dict set tmp $ele kickList($chan)}set kickList($chan) [dict keys $tmp]enforce:kick $chan}</code></pre></div>and call <em class="text-italics">filter:kick</em> in the <em class="text-italics">after</em> line instead of the enforce:kick.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Tue Jan 10, 2023 12:49 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2023-01-10T05:59:14-04:00</updated>

		<published>2023-01-10T05:59:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111609#p111609</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111609#p111609"/>
		<title type="html"><![CDATA[check if nick is still on channel before kicking]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111609#p111609"><![CDATA[
Using the original one you posted didn't seem to trigger SpiKe i will try again later when im on pc and report again hopefully thanks SpiKe<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Tue Jan 10, 2023 5:59 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2023-01-10T04:32:40-04:00</updated>

		<published>2023-01-10T04:32:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111608#p111608</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111608#p111608"/>
		<title type="html"><![CDATA[check if nick is still on channel before kicking]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111608#p111608"><![CDATA[
No, it was "proper" as I posted it originally.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Tue Jan 10, 2023 4:32 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2023-01-10T03:02:24-04:00</updated>

		<published>2023-01-10T03:02:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111607#p111607</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111607#p111607"/>
		<title type="html"><![CDATA[check if nick is still on channel before kicking]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111607#p111607"><![CDATA[
i tried editing it to this :<br><br><div class="codebox"><p>Code: </p><pre><code>      foreach k "[lsort -unique -dictionary $kickList($chan)]" {         if {[onchan $k $chan]} {  lappend knicks $k  }      }</code></pre></div>it seems to have fixed it but not sure if i edited it proper tho<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Tue Jan 10, 2023 3:02 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2023-01-10T02:54:58-04:00</updated>

		<published>2023-01-10T02:54:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111606#p111606</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111606#p111606"/>
		<title type="html"><![CDATA[check if nick is still on channel before kicking]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111606#p111606"><![CDATA[
thanks for the reply CrazyCat and SpiKe^^<br><br>yes i overlooked the duplicate timers to kick thanks for correcting CrazyCat<br><br>i tried your posted code and it didnt seem to Trigger SpiKe^^ and i didnt get any errors<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Tue Jan 10, 2023 2:54 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2023-01-09T19:27:28-04:00</updated>

		<published>2023-01-09T19:27:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111605#p111605</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111605#p111605"/>
		<title type="html"><![CDATA[enforceBans]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111605#p111605"><![CDATA[
maybe...<br><div class="codebox"><p>Code: </p><pre><code>namespace eval enforceBans {  variable enforce  ;  variable kickList   set enforce(max) "4"   set enforce(reason_single) "Please respect the network rules, thank you."   set enforce(reason_multi) "Please respect the network rules, thank you."   bind mode - "% +b" [namespace current]::enforce   proc enforce {nick uhost hand chan mc ban} {      variable kickList      if {[matchaddr $ban $::botname]} { return 0 }            foreach n [chanlist $chan] {         if {![matchaddr $ban $n![getchanhost $n $chan]]} { continue }         if {[isop $n $chan] || [ishalfop $n $chan]} { continue }         if {[matchattr [nick2hand $n] "fnmo|fnmo" $chan]} { continue }         lappend klist $n      }      if {![info exists klist]} { return 0 }      if {![info exists kickList($chan)]} {         set kickList($chan) $klist         after 2300 [list "[namespace current]::enforce:kick" $chan]       } else {  lappend kickList($chan) {*}$klist  }      return 0   }   proc enforce:kick {chan} {      variable enforce      variable kickList      if {![botisop $chan] || ![info exists kickList($chan)]} {         if {[info exists kickList($chan)]} {  unset kickList($chan)  }         return 0      }      foreach k [lsort -unique -dictionary $kickList($chan)] {         if {[onchan $k $chan]} {  lappend knicks $k  }      }      unset kickList($chan)      if {![info exists knicks]} {  return 0  }      set max $enforce(max)      set reason [string map [list %from $chan] $enforce(reason_multi)]      while {[set len [llength $knicks]] &gt; 0} {        if {$len &gt; $max} {          set nicks [join [lrange $knicks 0 [expr {$max - 1}]] ","]          set knicks [lrange $knicks $max end]        } else {          set nicks [join $knicks ","]          set knicks ""        }        putnow "KICK $chan $nicks :$reason"      }      return 0   }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Mon Jan 09, 2023 7:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2023-01-09T19:15:26-04:00</updated>

		<published>2023-01-09T19:15:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111604#p111604</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111604#p111604"/>
		<title type="html"><![CDATA[check if nick is still on channel before kicking]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111604#p111604"><![CDATA[
This doesn't really solve your problem as the kick occures each 2s.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Mon Jan 09, 2023 7:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2023-01-09T16:21:00-04:00</updated>

		<published>2023-01-09T16:21:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111603#p111603</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111603#p111603"/>
		<title type="html"><![CDATA[check if nick is still on channel before kicking]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111603#p111603"><![CDATA[
i gave it a try and came of with this it seems to work but im not sure if its done proper <br><div class="codebox"><p>Code: </p><pre><code>   proc enforce:kick {chan} {      variable enforce      variable kickList      variable NewKickList      if {![botisop $chan] || ![info exists kickList($chan)]} {         array unset kickList $chan         return 0      }  foreach nickx $kickList($chan) { if {[onchan $nickx $chan]} {  set klist $nickx ;  lappend NewKickList($chan) $klist  } }      set knicks [lsort -unique -dictionary $NewKickList($chan)]      unset kickList($chan)      unset NewKickList($chan)       set max $enforce(max)      set reason [string map [list %from $chan] $enforce(reason_multi)]      while {[set len [llength $knicks]] &gt; 0} {        if {$len &gt; $max} {          set nicks [join [lrange $knicks 0 [expr {$max - 1}]] ","]          set knicks [lrange $knicks $max end]        } else {          set nicks [join $knicks ","]          set knicks ""        }         after 2000 [list putnow "KICK $chan $nicks :$reason"]      }      return 0   }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Mon Jan 09, 2023 4:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2023-01-08T20:41:48-04:00</updated>

		<published>2023-01-08T20:41:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111602#p111602</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111602#p111602"/>
		<title type="html"><![CDATA[check if nick is still on channel before kicking]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111602#p111602"><![CDATA[
greetingz gentz,<br><br>i'm wondering how to edit this code in the  kick proc to check if nick(s) are still in channel before executing the kick command(s) as we use a timer, let me post the code: <br><div class="codebox"><p>Code: </p><pre><code>namespace eval enforceBans {   set enforce(max) "4"   set enforce(reason_single) "Please respect the network rules, thank you."   set enforce(reason_multi) "Please respect the network rules, thank you."   bind mode - "% +b" [namespace current]::enforce   proc enforce {nick uhost hand chan mc ban} {      variable kickList      if {[matchaddr $ban $::botname]} { return 0 }            foreach n [chanlist $chan] {         if {![matchaddr $ban $n![getchanhost $n $chan]]} { continue }         if {[isop $n $chan] || [ishalfop $n $chan]} { continue }         if {[matchattr [nick2hand $n] "fnmo|fnmo" $chan]} { continue }         lappend klist $n      }      if {![info exists klist]} { return 0 }      if {![info exists kickList($chan)]} {         set kickList($chan) $klist         after 300 [list "[namespace current]::enforce:kick" $chan]       } else {  lappend kickList($chan) {*}$klist  }      return 0   }   proc enforce:kick {chan} {      variable enforce      variable kickList      if {![botisop $chan] || ![info exists kickList($chan)]} {         array unset kickList $chan         return 0      }      set knicks [lsort -unique -dictionary $kickList($chan)]      unset kickList($chan)      set max $enforce(max)      set reason [string map [list %from $chan] $enforce(reason_multi)]      while {[set len [llength $knicks]] &gt; 0} {        if {$len &gt; $max} {          set nicks [join [lrange $knicks 0 [expr {$max - 1}]] ","]          set knicks [lrange $knicks $max end]        } else {          set nicks [join $knicks ","]          set knicks ""        }         after 2000 [list putnow "KICK $chan $nicks :$reason"]      }      return 0   }}</code></pre></div>thanks in advance gentz,<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Sun Jan 08, 2023 8:41 pm</p><hr />
]]></content>
	</entry>
	</feed>
