Formatting of code : You can (and must) use [ tcl ] an [ /tcl ] tags (without spaces in tags) to format your TCL codes and have syntax coloration x


CTweather
#1
Hey everyone, this is a beta release of CTweather, i'll be working on another release later today. :) (btw: not sure if i should be speaking English or French, Mods please let me know, hehe)



tcl
namespace eval CTweather {
   ## Trigger
   variable trig "!w
 
   ## Flag
   variable flag "of|of
 
   ###
 
   variable api "8c2a600d5d63d7fb13432fd58dcc419
 
   variable type "imperia
 
   package require js
   package require tl
   package require htt
 
   bind PUB $flag $trig [namespace current]::mainpr
 
   proc mainproc {nick host hand chan text}
      variable api ;variable typ
      ::http::register https 443 [list ::tls::socket
      variable url "https://nominatim.openstreetmap.org/search/
      variable params [::http::formatQuery q $text format jsonv2
        putlog "$url?$params
      variable data [http::data [http::geturl "$url?$params" -timeout 10000]
      variable data2 [json::json2dict $data
      variable name [dict get [lindex $data2 0] "display_name"
      variable lati [dict get [lindex $data2 0] "lat"
      variable long [dict get [lindex $data2 0]  "lon"
      variable url2 "https://api.openweathermap.org/data/2.5/weather
        variable params2 [::http::formatQuery q [lindex [split $text] 0] lat $lati lon $long appid $api
        putlog "$url2?$params2
      variable bata [http::data [http::geturl "$url2?$params2" -timeout 10000]
      variable zata [::json::json2dict $bata
      variable temp [dict get [dict get $zata "main"] "temp"
      variable speed [dict get [dict get $zata "wind"] "speed"
      variable degre [dict get [dict get $zata "wind"] "deg"
      variable humid [dict get [dict get $zata "main"] "humidity"
      variable cover [dict get [dict get $zata "clouds"] "all"
      variable desc [dict get [lindex [dict get $zata weather] 0] "description"
      variable sign [encoding convertfrom "utf-8" "?"
      switch -exact $type 
         "metric" {variable type2 "${sign}F"
         "imperial" {variable type2 "${sign}C"
      
      putserv "PRIVMSG $chan :\[\00309Weather\003\] Location: $name || Longitutde: $long  || Latitude: $lati || Temperature:: ${temp}$type2 || Humidity: ${humid}% 
      putserv "PRIVMSG $chan :Wind:: ${speed}MPH  Degree: $degre || Description:: $desc  || Clouds: ${cover}%
   
 
}}""}}}{]]]]]]]]]"]"]]]]]"]"]e {ocpsonl"b"##"s.".iption:: $desc || Clouds: ${cover}%"
   }
}

  Reply
#2
You can announce scripts release here, but scripts must be shared in https://scripts.eggdrop.fr/

Login and password are the same than the forum ones, and CT Weather must go in https://scripts.eggdrop.fr/News+-+RSS+-+...ns-c5.html (News - RSS - Informations).

The script you put here seems broken: }}""}}}{]]]]]]]]]"]"]]]]]"]"]e {ocpsonl"b"##"s.".iption:: $desc || Clouds: ${cover}%" is really strange
zeolia: tchat gratuit, sans inscription ni publicité
Merci de ne pas demander d'aide en MP
Away
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)