Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # created by Yxaaaaaaa ( http://www.egghelp-bg.com )
- # http://voting.freeunibg.eu/sugg.html checking
- package require http
- namespace eval evoting {
- ## checking every 10 minutes
- bind time - "10 * * * *" [namespace current]::checkvotingtime
- bind time - "20 * * * *" [namespace current]::checkvotingtime
- bind time - "30 * * * *" [namespace current]::checkvotingtime
- bind time - "40 * * * *" [namespace current]::checkvotingtime
- bind time - "50 * * * *" [namespace current]::checkvotingtime
- bind time - "00 * * * *" [namespace current]::checkvotingtime
- variable fileVotingDb ./votingDb.txt
- variable vchannel #clashr
- # don't teach below
- # for test purposes:
- bind pub - !voting [namespace current]::checkvotingch
- bind pub - !updatedb [namespace current]::checkvotingtime
- proc checkvotingch {n u h c t} {
- set token [::http::geturl "http://voting.freeunibg.eu/sugg.html" -timeout 30000]
- set data [::http::data $token]
- set matches [regexp -nocase -all {<tr>\n<td>\n<a href="sugg-view-(.+?).html">(.+?)<\/a>\n<\/td>\n<td>} $data]
- # if { [regexp -all -nocase -- {<tr>\n<td>\n<a href="sugg-view-(.+?).html">(.+?)<\/a>\n<\/td>\n<td>} $data -> webId vote] } {
- putquick "PRIVMSG $c :LAST VOTINGS:"
- foreach {_ webId vote} $matches {
- putquick "PRIVMSG $c :Last voting: $vote -> http://voting.freeunibg.eu/sugg-view-$webId.html"
- }
- # }
- }
- proc checkvotingtime {1 2 3 4 5} {
- variable fileVotingDb
- variable vchannel
- set f [open $fileVotingDb r]
- set readdata [read -nonewline $f]
- close $f
- set lastline [lindex [split $readdata "\n"] end]
- set token [::http::geturl "http://voting.freeunibg.eu/sugg.html" -timeout 30000]
- set data [::http::data $token]
- if { [regexp -nocase -- {<tr>\n<td>\n<a href="sugg-view-(.+?).html">(.+?)<\/a>\n<\/td>\n<td>} $data -> webId vote] } {
- if {$lastline != "http://voting.freeunibg.eu/sugg-view-$webId.html"} {
- ## putquick "OPERWALL :IMPORTANT UPDATE -> $vote -> http://voting.freeunibg.eu/sugg-view-$webId.html"
- putquick "PRIVMSG $vchannel :IMPORTANT UPDATE -> $vote -> http://voting.freeunibg.eu/sugg-view-$webId.html"
- set fileId [open $fileVotingDb "w"]
- puts $fileId "http://voting.freeunibg.eu/sugg-view-$webId.html"
- close $fileId
- }
- }
- }
- proc evoting:initial {fileDb} {
- if {![file exists $fileDb]} {
- set f [open $fileDb "w"]
- close $f
- }
- }
- evoting:initial $fileVotingDb
- putlog "voting.freeunibg.eu checker by Yxaaaaaaa"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement