Advertisement
makmukiper

TCL Gempa BMKG

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