<?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/21099" />

	<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>2022-01-19T09:52:22-04:00</updated>

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

		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2022-01-19T09:52:22-04:00</updated>

		<published>2022-01-19T09:52:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110812#p110812</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110812#p110812"/>
		<title type="html"><![CDATA[ban duration convert from: y-m-w-d-h to minute]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110812#p110812"><![CDATA[
your code seems to work proper Spike^^<br><br>CrazyCat your code seems to set ban duration permanent regardless of what is used<br><br>i used like : !addbl *!*@*.RU 2w uit testen<br><br>and it sets it as permanent ban i get no errors tho<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Wed Jan 19, 2022 9:52 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2022-01-19T04:09:40-04:00</updated>

		<published>2022-01-19T04:09:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110811#p110811</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110811#p110811"/>
		<title type="html"><![CDATA[ban duration convert from: y-m-w-d-h to minute]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110811#p110811"><![CDATA[
<blockquote class="uncited"><div>tested your latest code CC and got:<br><br>Tcl error [sticky_bansx]: missing operand at _@_<br>in expression "365*24*60*_@_"</div></blockquote>Well, I'm too used to use languages interpreting "" as 0 <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Here is the corrected proc:<div class="codebox"><p>Code: </p><pre><code>proc delay2min {delay} {   regexp {((\d{1,})y)?((\d{1,})w)?((\d{1,})d)?((\d{1,})h)?(\d{1,})?} $delay - iy by iw bw id bd ih bh bm   set min 0   if {[string is integer by]} { incr min [expr 365*24*60*$by] }   if {[string is integer bw]} { incr min [expr 7*24*60*$bw] }   if {[string is integer bd]} { incr min [expr 24*60*$bd] }   if {[string is integer bh]} { incr min [expr 60*$bh] }   if {[string is integer bm]} { incr min [expr 1*$bm] }   return $min}</code></pre></div>@SpiKe^^ : you have a small error in your script:<div class="codebox"><p>Code: </p><pre><code>set dur [duration [expr {60*$min}]]</code></pre></div>$min is in minutes, why do you convert it into seconds ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Wed Jan 19, 2022 4:09 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2022-01-19T03:07:54-04:00</updated>

		<published>2022-01-19T03:07:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110810#p110810</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110810#p110810"/>
		<title type="html"><![CDATA[ban duration convert from: y-m-w-d-h to minute]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110810#p110810"><![CDATA[
Fix cat's error by adding the [catch]es like I added to mine.<br>an empty string cant be used in an exp:)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Wed Jan 19, 2022 3:07 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2022-01-19T03:04:11-04:00</updated>

		<published>2022-01-19T03:04:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110809#p110809</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110809#p110809"/>
		<title type="html"><![CDATA[ban duration convert from: y-m-w-d-h to minute]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110809#p110809"><![CDATA[
That's odd, I get a $min of 10080<br><br>That should work as a good expire time as it is an integer number.<br><br>Have you used the very last code I posted without edits?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Wed Jan 19, 2022 3:04 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2022-01-19T00:56:26-04:00</updated>

		<published>2022-01-19T00:56:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110808#p110808</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110808#p110808"/>
		<title type="html"><![CDATA[ban duration convert from: y-m-w-d-h to minute]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110808#p110808"><![CDATA[
i did some more testing with your code Spike^^ and found bug<br><br><br>when i do like : !addbl *!*@*.RU 1w uit testen<br><br>i get<br><blockquote class="uncited"><div>Tcl error [permanent_ban]: bogus expire time</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Wed Jan 19, 2022 12:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2022-01-19T00:48:18-04:00</updated>

		<published>2022-01-19T00:48:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110807#p110807</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110807#p110807"/>
		<title type="html"><![CDATA[ban duration convert from: y-m-w-d-h to minute]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110807#p110807"><![CDATA[
tested your latest code CC and got:<br><br>Tcl error [sticky_bansx]: missing operand at _@_<br>in expression "365*24*60*_@_"<br><br><br><br>ive edited it like this but it didnt seem to help as i still got error<br><br><br><br><br><div class="codebox"><p>Code: </p><pre><code>proc delay2min {delay} {   regexp {((\d{1,})y)?((\d{1,})w)?((\d{1,})d)?((\d{1,})h)?(\d{1,})?} $delay - iy by iw bw id bd ih bh bm   set min 0   incr min [expr {365*24*60*$by}]   incr min [expr {7*24*60*$bw}]   incr min [expr {24*60*$bd}]   incr min [expr {60*$bh}]   incr min [expr {1*$bm}]   return $min}</code></pre></div><br>Tcl error [sticky_bansx]: can't use empty string as operand of "*"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Wed Jan 19, 2022 12:48 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2022-01-18T05:12:57-04:00</updated>

		<published>2022-01-18T05:12:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110806#p110806</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110806#p110806"/>
		<title type="html"><![CDATA[ban duration convert from: y-m-w-d-h to minute]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110806#p110806"><![CDATA[
My code is corrected (forget to replace time with delay in proc)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Tue Jan 18, 2022 5:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2022-01-18T04:36:47-04:00</updated>

		<published>2022-01-18T04:36:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110805#p110805</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110805#p110805"/>
		<title type="html"><![CDATA[ban duration convert from: y-m-w-d-h to minute]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110805#p110805"><![CDATA[
your posted code seems to work well thanks Spike^^<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Tue Jan 18, 2022 4:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2022-01-18T04:28:34-04:00</updated>

		<published>2022-01-18T04:28:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110804#p110804</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110804#p110804"/>
		<title type="html"><![CDATA[ban duration convert from: y-m-w-d-h to minute]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110804#p110804"><![CDATA[
tried your last post cc:<br><br>Tcl error [sticky_bans]: can't read "time": no such variable<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Tue Jan 18, 2022 4:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2022-01-18T05:12:26-04:00</updated>

		<published>2022-01-18T04:00:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110803#p110803</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110803#p110803"/>
		<title type="html"><![CDATA[ban duration convert from: y-m-w-d-h to minute]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110803#p110803"><![CDATA[
This may correct the two bugs (nick and improper set)<div class="codebox"><p>Code: </p><pre><code>bind pub o|o !addbl permanent_banproc permanent_ban {nick host hand chan text} {set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]set items [split $text]if {[llength $items] &lt; 3} {putnow "notice $nick :Syntax !addbl &lt;target&gt; &lt;banduration&gt; &lt;reason&gt;" ;  return 0}set reason [join [lassign $items target time]]#if {$reason eq ""} {  set reason "default reason"  } ;# reason cant be empty:) #if {[matchaddr $target $::botname]} { return 0 }if {[matchstr permanent $time] || [matchstr perm $time] || [matchstr p $time]} {set min 0} else {set min [delay2min $time]}if {![string is digit -strict $min]} {putnow "NOTICE $nick :Sorry, can't calculate delay"return}newchanban $chan [join $target] $nick [join $reason] $min stickyif {$min == 0} {            set dur "forever"} else {            set dur $min}putnow "notice $nick :Added new sticky ban to the Eggdrop user file (duration: $dur)."return 0}proc delay2min {delay} {regexp {((\d{1,})y)?((\d{1,})w)?((\d{1,})d)?((\d{1,})h)?(\d{1,})?} $delay - iy by iw bw id bd ih bh bmset min 0incr min [expr 365*24*60*$by]incr min [expr 7*24*60*$bw]incr min [expr 24*60*$bd]incr min [expr 60*$bh]incr min [expr 1*$bm]return $min}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Tue Jan 18, 2022 4:00 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2022-01-18T03:38:17-04:00</updated>

		<published>2022-01-18T03:38:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110802#p110802</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110802#p110802"/>
		<title type="html"><![CDATA[ban duration convert from: y-m-w-d-h to minute]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110802#p110802"><![CDATA[
tried your version Spike^^ but setting bans on nicks like [nick] doesnt seem to work proper it sets it as {[nick]}<br><br><br>tested your version as well CC same issue and gettin error:<br><br><br>08:51:55 &lt;Hawk&gt; [08:51:55] Tcl error [sticky_bansx]: invalid bareword "set"<br>08:51:55 &lt;Hawk&gt; in expression "<br>08:51:55 &lt;Hawk&gt;      set min [delay2min $time]...";<br>08:51:55 &lt;Hawk&gt; should be "$set" or "{set}" or "set(...)" or ...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Tue Jan 18, 2022 3:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2022-01-18T03:56:56-04:00</updated>

		<published>2022-01-18T03:24:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110801#p110801</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110801#p110801"/>
		<title type="html"><![CDATA[ban duration convert from: y-m-w-d-h to minute]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110801#p110801"><![CDATA[
Why not just modify my regex to allow minutes:<div class="codebox"><p>Code: </p><pre><code>proc delay2min {delay} {regexp {((\d{1,})y)?((\d{1,})w)?((\d{1,})d)?((\d{1,})h)?(\d{1,})?} $time - iy by iw bw id bd ih bh bmset min 0   incr min [expr 365*24*60*$by]   incr min [expr 7*24*60*$bw]   incr min [expr 24*60*$bd]   incr min [expr 60*$bh]   incr min [expr 1*$bm]   return $min}</code></pre></div>If argument is only an integer, it's minutes.<br><br>So, new code is:<div class="codebox"><p>Code: </p><pre><code>bind pub o|o !addbl permanent_banproc permanent_ban {nick host hand chan text} {  set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]  set items [split $text]  if {[llength $items] &lt; 3} {    putnow "notice $nick :Syntax !addbl &lt;target&gt; &lt;banduration&gt; &lt;reason&gt;" ;  return 0  }  set reason [join [lassign $items target time]]  #if {$reason eq ""} {  set reason "default reason"  } ;# reason cant be empty:) #  if {[matchaddr $target $::botname]} { return 0 }  if {[matchstr permanent $time] || [matchstr perm $time] || [matchstr p $time]} {     set min 0  } elseif {     set min [delay2min $time]  }  if {![string is digit -strict $min]} {     putnow "NOTICE $nick :Sorry, can't calculate delay"     return  }   newchanban $chan $target $nick $reason $min sticky  if {$min == 0} {  set dur "forever"  } else {  set dur [duration [expr {60*$min}]]  }  putnow "notice $nick :Added new sticky ban to the Eggdrop user file (duration: $dur)."  return 0}proc delay2min {delay} {regexp {((\d{1,})y)?((\d{1,})w)?((\d{1,})d)?((\d{1,})h)?(\d{1,})?} $time - iy by iw bw id bd ih bh bmset min 0   incr min [expr 365*24*60*$by]   incr min [expr 7*24*60*$bw]   incr min [expr 24*60*$bd]   incr min [expr 60*$bh]   incr min [expr 1*$bm]   return $min}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Tue Jan 18, 2022 3:24 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2022-01-18T03:11:59-04:00</updated>

		<published>2022-01-18T03:11:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110800#p110800</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110800#p110800"/>
		<title type="html"><![CDATA[ban duration convert from: y-m-w-d-h to minute]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110800#p110800"><![CDATA[
Combined and cleaned up that might look something like...<div class="codebox"><p>Code: </p><pre><code>bind pub o|o !addbl permanent_banproc permanent_ban {nick host hand chan text} {  set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]  set items [split $text]  if {[llength $items] &lt; 3} {    putnow "notice $nick :Syntax !addbl &lt;target&gt; &lt;banduration&gt; &lt;reason&gt;" ;  return 0  }  set reason [join [lassign $items target time]]  #if {$reason eq ""} {  set reason "default reason"  } ;# reason cant be empty:) #  if {[matchaddr $target $::botname]} { return 0 }  if {[matchstr permanent $time] || [matchstr perm $time] || [matchstr p $time]} {  set min 0  } elseif {[string is digit -strict $time]} {  set min $time  ### Thanks CrazyCat ###  } else {  set min 0    regexp {((\d{1,})y)?((\d{1,})w)?((\d{1,})d)?((\d{1,})h)?} $time - iy by iw bw id bd ih bh    catch { incr min [expr {365*24*60*$by}] }    catch { incr min [expr {7*24*60*$bw}] }    catch { incr min [expr {24*60*$bd}] }    catch { incr min [expr {60*$bh}] }  }  newchanban $chan $target $nick $reason $min sticky  if {$min == 0} {  set dur "forever"  } else {  set dur [duration [expr {60*$min}]]  }  putnow "notice $nick :Added new sticky ban to the Eggdrop user file (duration: $dur)."  return 0}</code></pre></div>&lt;banduration&gt; can be done in several ways:<br>a)  1y26w  |or|   1d12h  |or|  other variations of 1y2w3d4h (in that order)(every values are optional)<br>b)  any integer number (of minutes).  example:  150  (= 150 minutes or 2 and a half hours)<br>c) perm  |or|  p  |or|  permanent  |or|  0  (= a forever permanent ban)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Tue Jan 18, 2022 3:11 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2022-01-17T19:21:40-04:00</updated>

		<published>2022-01-17T19:21:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110799#p110799</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110799#p110799"/>
		<title type="html"><![CDATA[ban duration convert from: y-m-w-d-h to minute]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110799#p110799"><![CDATA[
Short proc, not tested in situ:<div class="codebox"><p>Code: </p><pre><code>proc delay2min {delay} {regexp {((\d{1,})y)?((\d{1,})w)?((\d{1,})d)?((\d{1,})h)?} $delay - iy by iw bw id bd ih bhset min 0incr min [expr 365*24*60*$by]incr min [expr 7*24*60*$bw]incr min [expr 24*60*$bd]incr min [expr 60*$bh]return $min}</code></pre></div>The param must follow the order 1y2w3d4h (every values are optional), so you can use <strong class="text-strong">delay2min 1y17h</strong> or <strong class="text-strong">delay2min 52w1d</strong> but you CAN NOT do <em class="text-italics">delay2min 1d2w</em><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Mon Jan 17, 2022 7:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2022-01-17T18:25:26-04:00</updated>

		<published>2022-01-17T18:25:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=110798#p110798</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=110798#p110798"/>
		<title type="html"><![CDATA[ban duration convert from: y-m-w-d-h to minute]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=110798#p110798"><![CDATA[
oh thats true forgot about that Spike^^ lets say we use days and weeks to counter that<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Mon Jan 17, 2022 6:25 pm</p><hr />
]]></content>
	</entry>
	</feed>
