Code: Select all
#Channel-A 56 users
#Channel-B 191 users
#Channel-C 44 users
#Channel-D 19 users
#Channel-E 26 users
#Channel-F 74 users
#Channel-G 122 users
#Channel-H 16 users
#Channel-I 37 users
Any help?
Thanks to all.
Code: Select all
#Channel-A 56 users
#Channel-B 191 users
#Channel-C 44 users
#Channel-D 19 users
#Channel-E 26 users
#Channel-F 74 users
#Channel-G 122 users
#Channel-H 16 users
#Channel-I 37 users
Code: Select all
bind time - "* * * * *" web_users
# Path to save html page.
set webusers_file "/var/www/123/web_users.html"
proc web_users {min hour day month year} {
global webusers_file
if {[file exists "$webusers_file"]} {
set fh [open "$webusers_file" "a+"]
}
set fh [open "$webusers_file" "w+"]
puts $fh "<HTML><HEAD><TITLE>Total users</TITLE></HEAD>"
puts $fh "<BODY>"
foreach chan [channels] {
set users [chanlist $chan]
puts $fh "$chan: [llength $users] users<BR />"
}
puts $fh "</BODY></HTML>"
close $fh
}
Code: Select all
bind time - "5 * * * *" web_users
Code: Select all
/home/my-username/eggdrop/webusers/users.html
Code: Select all
#sun: 0 users (must be 80)
#uruguay: 0 users (must be 83)
#linux: 19 users
#yuyos: 5 users
#friends: 17 users
You reminded me of:rayvtirx wrote: ...
any way i could get the nicks of the users in the channel or channels?
and probably asking a bit much now - but perhaps a way to exclude the count of certain nicks ( a bot for example)?
rayvtirx wrote: ...
really all i need is a couple of text files produced one with the number of users in it and another with the usernames,
...
i can remove the bot from all but the #AirfixDogfighter channel. but the number will always include the bot - i could just -1 it in php . the usernames was me asking if there was another kind of a string like the users one in the script that gets the usernames , again i could just preg_replace out the bots name
Code: Select all
bind time - "* * * * *" web_users
# Path to save text files.
set webusers_file "you/need/to/edit/this/path/web_users.txt"
set webusers_count_file "you/need/to/edit/this/path/web_users_count.txt"
proc web_users {min hour day month year} {
global webusers_file webusers_count_file botnick
set fh [open "$webusers_file" "w+"]
set nicklist "[chanlist #AirfixDogfighter]"
set i "0"
foreach nick $nicklist {
if {"$nick" == "$botnick"} {
set newnicklist [lreplace $nicklist $i $i ]
}
incr i
}
puts $fh [join $newnicklist ", " ]
close $fh
set fh [open "$webusers_count_file" "w+"]
puts $fh "[expr [llength [chanlist #AirfixDogfighter]] - 1 ]"
close $fh
}
Code: Select all
[chanlist #AirfixDogfighter]] - 1 ]"
Code: Select all
bind time - "* * * * *" web_users
# Path to save text files.
set webusers_file "you/need/to/edit/this/path/web_users.txt"
set webusers_count_file "you/need/to/edit/this/path/web_users_count.txt"
proc web_users {min hour day month year} {
global webusers_file webusers_count_file botnick
set fh [open "$webusers_file" "w+"]
set nicklist "[chanlist #AirfixDogfighter]"
set i "0"
set b "0"
foreach nick $nicklist {
if {"$nick" == "$botnick"} {
set newnicklist [lreplace $nicklist $i $i ]
incr b
}
incr i
}
puts $fh [join $newnicklist ", " ]
close $fh
set fh [open "$webusers_count_file" "w+"]
puts $fh "[expr [llength [chanlist #AirfixDogfighter]] - $b ]"
close $fh
}
you should use the 'isbonick' function instead, or at least either 'string tolower' both variables or 'string equal -nocase' them.if {"$nick" == "$botnick"} {
Code: Select all
bind time - "* * * * *" time:webusers
# Path to save text files.
set webusers(file) "you/need/to/edit/this/path/web_users.txt"
set webusers(count_file) "you/need/to/edit/this/path/web_users_count.txt"
set webusers(exclude) "bot1 bot2 bot3 user1 user2"
proc time:webusers {min hour day month year} {
global webusers
set i 0
foreach nick [chanlist #AirfixDogfighter] {
if {[isbotnick $nick] || [lsearch -nocase $webusers(exclude) $nick] == -1} continue
lappend nicklist $nick
incr i
}
set fh [open $webusers(file) "w"]
puts $fh [join $nicklist ", "]
close $fh
set fh [open $webusers(count_file) "w"]
puts $fh "$i"
close $fh
}
Code: Select all
[lsearch -nocase $webusers(exclude) $nick] == -1
Code: Select all
[matchattr [nick2hand $nick] bf #AirfixDogfighter]
thus no need for:Open the file for reading and writing. If the file does not exist, create a new empty file. Set the initial access position to the end of the file.
not to mention that you open a file and forgot to close it before opening it again.if {[file exists "$webusers_file"]} {
set fh [open "$webusers_file" "a+"]
}
set fh [open "$webusers_file" "w+"]
I think I understand what you really want... for the script to examine each of the users currently in the channel, and some how be able to determine if a given user is a bot, or not.rayvtirx wrote: ...
edit:
i stopped by your channel agin and asked but noone seemed to know
...
ive tried thiswith the intention that it automatically ignore bots in the count_fileCode: Select all
puts $fh "[expr [llength [chanlist #AirfixDogfighter]] - $b ]" close $fh }
It seems to work (though i only rehashed the bot)