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 

ban duration convert from: y-m-w-d-h to minute
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
SpiKe^^
Owner


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

PostPosted: Wed Jan 19, 2022 3:04 am    Post subject: Reply with quote

That's odd, I get a $min of 10080

That should work as a good expire time as it is an integer number.

Have you used the very last code I posted without edits?
_________________
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
SpiKe^^
Owner


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

PostPosted: Wed Jan 19, 2022 3:07 am    Post subject: Reply with quote

Fix cat's error by adding the [catch]es like I added to mine.
an empty string cant be used in an exp:)
_________________
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
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Wed Jan 19, 2022 4:09 am    Post subject: Reply with quote

simo wrote:
tested your latest code CC and got:

Tcl error [sticky_bansx]: missing operand at _@_
in expression "365*24*60*_@_"

Well, I'm too used to use languages interpreting "" as 0 Smile

Here is the corrected proc:
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
}


@SpiKe^^ : you have a small error in your script:
Code:
set dur [duration [expr {60*$min}]]

$min is in minutes, why do you convert it into seconds ?
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Wed Jan 19, 2022 9:52 am    Post subject: Reply with quote

your code seems to work proper Spike^^

CrazyCat your code seems to set ban duration permanent regardless of what is used

i used like : !addbl *!*@*.RU 2w uit testen

and it sets it as permanent ban i get no errors tho
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
Goto page Previous  1, 2
Page 2 of 2

 
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