| View previous topic :: View next topic |
| Author |
Message |
BigToe Halfop
Joined: 30 Dec 2010 Posts: 99
|
Posted: Sat Jun 14, 2014 12:42 pm Post subject: Count ban time |
|
|
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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Jun 14, 2014 3:12 pm Post subject: |
|
|
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 |
|
 |
BigToe Halfop
Joined: 30 Dec 2010 Posts: 99
|
Posted: Sat Jun 14, 2014 7:02 pm Post subject: |
|
|
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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Jun 14, 2014 7:13 pm Post subject: |
|
|
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 |
|
 |
Get_A_Fix Master

Joined: 07 May 2005 Posts: 206 Location: New Zealand
|
Posted: Sat Aug 16, 2014 2:05 pm Post subject: |
|
|
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 |
|
 |
|