Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bind cron - "* * * * *" cekgempa
- set lastgempa "reset tiap rehash/restart"
- proc cekgempa {1 2 3 4 5} {
- set chgempa "#Mojok"
- http::register https 443 [list ::tls::socket -autoservername 1]
- http::config -proxyhost "" -useragent ""
- if {[catch {set bmkgpage [http::geturl "https://data.bmkg.go.id/DataMKG/TEWS/autogempa.xml" -timeout 30000]} error]} { return $error }
- set bmkgdata [http::data $bmkgpage]
- http::cleanup $bmkgpage
- regexp -nocase {Tanggal>(.*?)<.*?Jam>(.*?)<.*?Lintang>(.*?)<.*?Bujur>(.*?)<.*?Magnitude>(.*?)<.*?Kedalaman>(.*?)<.*?Wilayah>(.*?)<.*?Shakemap>(.*?)<} $bmkgdata t tgl jam lt bj mag kdlm wlyh map
- set gempa "$tgl $jam # $lt/$bj # M$mag # Kedalaman $kdlm # $wlyh # https://static.bmkg.go.id/$map"
- if {$gempa != $::lastgempa} {
- foreach c $chgempa { putnow "privmsg $c :Gempa Terkini : $gempa" }
- set ::lastgempa $gempa
- }
- return
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement