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 

Count ban time

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


Joined: 30 Dec 2010
Posts: 99

PostPosted: Sat Jun 14, 2014 12:42 pm    Post subject: Count ban time Reply with quote

Hi,

Looking for a script that will log channel (#channel1) bans as in: when they were set, by who, what is the ban and announce in #channel2 every 30 mins how long its been since those bans added.

ie:

#channel1:

[14:03] * johnny sets mode: +b *!*@sphex.users.quakenet.org
[14:15] * johnny sets mode: +b *!*@tony.users.quakenet.org

[17:33] * johnny sets mode: -b *!*@tony.users.quakenet.org

#channel2:

[14:33] <Bot> *!*@sphex.users.quakenet.org is still banned in #channel1, the ban was set 30 minutes ago by johnny
[14:45] <Bot> *!*@tony.users.quakenet.org is still banned in #channel1, the ban was set 30 minutes ago by johnny


[18:03] <Bot> *!*@sphex.users.quakenet.org is still banned in #channel1, the ban was set 240 minutes ago by johnny

This applies only to bans that are still listed as bans in #channel1, not those that have been removed in the meantime
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jun 14, 2014 3:12 pm    Post subject: Reply with quote

Something like this should do the trick... Code is untested though.

Code:
namespace eval BanReport {
  variable SourceChannel "#channel1"
  variable DestinationChannel "#channel2"

  proc reportBans {minute hour day month weekday} {
    variable SourceChannel
    variable DestinationChannel
    foreach ban [chanbans $SourceChannel] {
      puthelp "PRIVMSG $DestinationChannel :[lindex $ban 0] is still banned in ${SourceChannel}, the ban was set [expr [lindex $ban 2] / 60] minutes ago by [lindex $ban 1]"
    }
  }
  bind cron - "*/30" [namespace code reportBans]
}

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
BigToe
Halfop


Joined: 30 Dec 2010
Posts: 99

PostPosted: Sat Jun 14, 2014 7:02 pm    Post subject: Reply with quote

Hi, thanks for the script!

It seems to be working pretty good, one thing though, it doesn't calculate the bans' time correctly.. I mean, it doesn't look at the banlist and check when the ban was aded right? because when I restarted the bot, 30 mins later when announcing the bans it said all the bans were added 30 mins ago and that wasn't the case
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Jun 14, 2014 7:13 pm    Post subject: Reply with quote

The script checks the banlist in the channel, not the bot's internal banlist. If a ban is already present when the bot joins the channel, it will use it's own time of joining the channel as the ban creation time.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Get_A_Fix
Master


Joined: 07 May 2005
Posts: 206
Location: New Zealand

PostPosted: Sat Aug 16, 2014 2:05 pm    Post subject: Reply with quote

you could alternatively have the bot match the raw numeric for bans, to match when they were really set on channel.

For example, /mode #channel1 b

This would return a list of banmasks, in the order they were banned (latest at the top, with older bans below). You could match the (time it was set) and either keep the ( ) in output, or parse them off.

It's an idea, but personally, the code that nml375 posted is perfect and would only require minimal tweaking to work on a raw bind.
_________________
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
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