This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
ORATEGOD
Halfop
Posts: 42 Joined: Mon Jun 08, 2020 5:50 pm
Post
by ORATEGOD » Mon Aug 12, 2024 4:16 pm
Hello friends!!
Is there any code that gives this type of statistics for a channel every X hours (example: every 2 hours)
Example:
Code: Select all
Stats #Channel: Join(s): 1234 | Part(s): 240 | Quit(s): 624 | Kick(s): 74 | Ban(s): 32 | Peak: 1589
Stats #Channel: ~ Total: 2 | & Total: 5 | @ Total: 3 | % Total: 2 | + Total: 45 | Total Users: 412
I appreciate your great help in advance.
CrazyCat
Revered One
Posts: 1301 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Mon Aug 12, 2024 6:18 pm
Not sure it exists, but quite easy to do.
I'm not sure to understand if the second line is live or statistical
ORATEGOD
Halfop
Posts: 42 Joined: Mon Jun 08, 2020 5:50 pm
Post
by ORATEGOD » Mon Aug 12, 2024 8:58 pm
CrazyCat wrote: ↑ Mon Aug 12, 2024 6:18 pm
Not sure it exists, but quite easy to do.
I'm not sure to understand if the second line is live or statistical
Hi
CrazyCat .. thanks for replying =)
The first line... is
statistics .
The second line... is
live .
simo
Revered One
Posts: 1108 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Tue Aug 13, 2024 3:32 am
you could try this for the live stats, you would need to find a way to store the stats for kicks bans and such.
also make sure you load thommey's ArbitraryChanmodes tcl to detect owners ~ and admins &
Code: Select all
# to enable: .chanset #channel +CheckChanStats
bind cron - {0 */2 * * *} ChanStats:Check:cron
setudef flag CheckChanStats
proc ChanStats:Check:cron {min hour day month weekday} {
foreach [string tolower channel] [channels] {
if {![channel get $channel CheckChanStats]} continue
set chan [string tolower $channel]
set owners 0
set admins 0
set ops 0
set hops 0
set voices 0
set regs 0
set users [chanlist $chan]
for { set total 0 } { $total < [llength $users] } { incr total } {
if {[isowner [lindex $users $total] $chan]} { incr owners } elseif {[isadmin [lindex $users $total] $chan]} { incr admins } elseif {[isop [lindex $users $total] $chan]} { incr ops } elseif {[ishalfop [lindex $users $total] $chan]} { incr hops } elseif {[isvoice [lindex $users $total] $chan]} { incr voices }
if {![isowner [lindex $users $total] $chan] && ![isadmin [lindex $users $total] $chan] && ![isop [lindex $users $total] $chan] && ![ishalfop [lindex $users $total] $chan] && ![isvoice [lindex $users $total] $chan]} { incr regs }
}
puthelp "privmsg $chan :ChanStats for $chan is: ~ Total: $owners | & Total: $admins | @ Total: $ops | % Total: $hops | + Total: $voices | regular Total: $regs | Total Users: $total"
return 0
}
}
Last edited by
simo on Tue Aug 13, 2024 5:55 am, edited 2 times in total.
CrazyCat
Revered One
Posts: 1301 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Tue Aug 13, 2024 5:13 am
You can try
https://gitlab.com/tcl-scripts/irc-stat ... cstats.tcl
I didn't added admins and owner in live stats because I can't test it, and the "total" users is the number of normal users.
This script is just a POC to help you, probably some bugs exist in it, but none appears in my small tests
ORATEGOD
Halfop
Posts: 42 Joined: Mon Jun 08, 2020 5:50 pm
Post
by ORATEGOD » Wed Aug 14, 2024 2:09 pm
CrazyCat wrote: ↑ Tue Aug 13, 2024 5:13 am
You can try
https://gitlab.com/tcl-scripts/irc-stat ... cstats.tcl
I didn't added admins and owner in live stats because I can't test it, and the "total" users is the number of normal users.
This script is just a POC to help you, probably some bugs exist in it, but none appears in my small tests
Thanks a lot CrazyCat , this script works very well.
CrazyCat
Revered One
Posts: 1301 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Wed Aug 14, 2024 4:57 pm
Nice
Keep in mind that these stats are volatile: they'll be reseted if you rehash/restart the eggdrop
Urores
Voice
Posts: 3 Joined: Mon Aug 12, 2024 7:32 pm
Post
by Urores » Wed Aug 21, 2024 6:06 am
If you’re using something like Python, you could set up a cron job or use a task scheduler to run the script every X hours. The script would gather the stats from the channel and log them accordingly.
Here’s a rough outline in Python:
import time
import your_channel_api # Replace with actual API library
def fetch_stats():
stats = your_channel_api.get_channel_stats('#Channel')
with open('stats_log.txt', 'a') as f:
f.write(f"Stats #Channel: Join(s): {stats['joins']} | Part(s): {stats['parts']} | Quit(s): {stats['quits']} | Kick(s): {stats['kicks']} | Ban(s): {stats['bans']} | Peak: {stats['peak']}\n")
f.write(f"Stats #Channel: ~ Total: {stats['total']['~']} | & Total: {stats['total']['&']} | @ Total: {stats['total']['@']} | % Total: {stats['total']['%']} | + Total: {stats['total']['+']} | Total Users: {stats['total']['users']}\n")
while True:
fetch_stats()
time.sleep(7200) # Sleep for 2 hours
You’ll need to adapt it based on your API and specific needs.
CrazyCat
Revered One
Posts: 1301 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Wed Aug 21, 2024 6:38 am
We're speaking about eggdrops, not about external python scripts.