<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/21131" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2023-10-01T14:55:48-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/21131</id>

		<entry>
		<author><name><![CDATA[aslpls]]></name></author>
		<updated>2023-10-01T14:55:48-04:00</updated>

		<published>2023-10-01T14:55:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=112196#p112196</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=112196#p112196"/>
		<title type="html"><![CDATA[Weather Script + extras]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=112196#p112196"><![CDATA[
Thanks for the help. it is working as I wanted...<div class="codebox"><p>Code: </p><pre><code>   }   putserv "PRIVMSG $chan :\00314Three day forecast for \00307$raddress ($address)\003"   set three_list [lreplace $three_list 0 0]   foreach t $three_list {      putserv "PRIVMSG $chan :$t"   }  }}   </code></pre></div>Output:<div class="codebox"><p>Code: </p><pre><code>&lt;+asL_pLs&gt; !3 dubai&lt;@wisp&gt; Three day forecast for دبي, الإمارات العربية المتحدة (dubai)&lt;@wisp&gt; Sun,  1 Oct - Clear conditions throughout the day. Temp: 31°C Feels like: 35°C Min/Max: (29°C/33°C) Percip: 0%&lt;@wisp&gt; Mon,  2 Oct - Clear conditions throughout the day. Temp: 31°C Feels like: 33°C Min/Max: (29°C/33°C) Percip: 0%&lt;@wisp&gt; Tue,  3 Oct - Clear conditions throughout the day. Temp: 32°C Feels like: 34°C Min/Max: (30°C/33°C) Percip: 0%</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12622">aslpls</a> — Sun Oct 01, 2023 2:55 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2023-10-01T09:59:52-04:00</updated>

		<published>2023-10-01T09:59:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=112195#p112195</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=112195#p112195"/>
		<title type="html"><![CDATA[Weather Script + extras]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=112195#p112195"><![CDATA[
Move this line:<div class="codebox"><p>Code: </p><pre><code>putserv "PRIVMSG $chan :\00314Three day forecast for \00307$raddress ($address)\003" </code></pre></div>above this line:<div class="codebox"><p>Code: </p><pre><code>set three_list [lreplace $three_list 0 0]</code></pre></div>and under }.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Sun Oct 01, 2023 9:59 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[aslpls]]></name></author>
		<updated>2023-10-01T03:40:12-04:00</updated>

		<published>2023-10-01T03:40:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=112194#p112194</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=112194#p112194"/>
		<title type="html"><![CDATA[Weather Script + extras]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=112194#p112194"><![CDATA[
Hi,<br><br>so far the script is working.. <br><br>see it here;<br><br><a href="https://ibb.co/RNyrvdr" class="postlink"><img src="https://i.ibb.co/cwLfgVf/w3.png" class="postimage" alt="Image"></a><br><br><br>but is there any chance we can minimize the 4 lines text above into 1 line only and then the Mon, Tue, Wed, ...<br><br><br>it should look like this<br><br><br>&lt;+asL_pLs&gt; !3 london<br>&lt;@wisp&gt; Three day forecast for London, England, United Kingdom (london)<br>&lt;@wisp&gt; Mon,  2 Oct - Cloudy skies throughout the day with late afternoon rain. Temp: 18°C Feels like: 18°C Min/Max: (16°C/21°C) Percip: 91%<br>&lt;@wisp&gt; Tue,  3 Oct - Partly cloudy throughout the day with early morning rain. Temp: 16°C Feels like: 16°C Min/Max: (13°C/18°C) Percip: 91%<br>&lt;@wisp&gt; Wed,  4 Oct - Cloudy skies throughout the day. Temp: 14°C Feels like: 14°C Min/Max: (11°C/18°C) Percip: 10%<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12622">aslpls</a> — Sun Oct 01, 2023 3:40 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bayo]]></name></author>
		<updated>2022-04-02T15:04:25-04:00</updated>

		<published>2022-04-02T15:04:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111050#p111050</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111050#p111050"/>
		<title type="html"><![CDATA[Weather Script + extras]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111050#p111050"><![CDATA[
Arnold_X-P, it can be, of course. The part with the group ID weather and the World cities weather change the Openweather url to <strong class="text-strong">lang es</strong>. For the Visualcrossing you will have to do the same, just at the end of the url put lang=es<br><br>Any other stuff will be manual I'm afraid (if any left)<br><br>Goga, I don't know what do you mean by exact as they are already there, but there you go the links:<br><br>OpenWeather @ <a href="https://home.openweathermap.org/users/sign_up" class="postlink">https://home.openweathermap.org/users/sign_up</a><br>  <br>IpGeoLocation @ <a href="https://ipgeolocation.io/signup.html" class="postlink">https://ipgeolocation.io/signup.html</a><br>  <br>Visualcrossing @ <a href="https://visualcrossing.com/sign-up" class="postlink">https://visualcrossing.com/sign-up</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12958">bayo</a> — Sat Apr 02, 2022 3:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Goga]]></name></author>
		<updated>2022-03-31T06:26:48-04:00</updated>

		<published>2022-03-31T06:26:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111044#p111044</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111044#p111044"/>
		<title type="html"><![CDATA[Weather Script + extras]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111044#p111044"><![CDATA[
Can you please provde exact link for API KYES?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12883">Goga</a> — Thu Mar 31, 2022 6:26 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Arnold_X-P]]></name></author>
		<updated>2022-03-30T17:35:37-04:00</updated>

		<published>2022-03-30T17:35:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111042#p111042</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111042#p111042"/>
		<title type="html"><![CDATA[Re: Weather Script + extras]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111042#p111042"><![CDATA[
can be configured for the spanish version?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8327">Arnold_X-P</a> — Wed Mar 30, 2022 5:35 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[bayo]]></name></author>
		<updated>2022-03-16T13:24:50-04:00</updated>

		<published>2022-03-16T13:24:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111014#p111014</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111014#p111014"/>
		<title type="html"><![CDATA[Weather Script + extras]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111014#p111014"><![CDATA[
<strong class="text-strong">EDIT: Added weather for top largest cities in the world</strong><br><br>Hello everyone, hope all is well. This is the script I was working on and it's finally done. <br><br>PREVIEW:<br><div class="codebox"><p>Code: </p><pre><code>[09:53] &lt;BAYO&gt; !w London[09:53] &lt;ec|ipse&gt; London, GB at the moment: 10°C Overcast Sky Cloudy Percip Prob 43% Humidity 83% Wind 9km/h from East-Southeast Wind gusts 10km/h Tomorrow: Min/Max (↓3°C/↑13C°)[09:53] &lt;ec|ipse&gt; Alerts: No[09:53] &lt;BAYO&gt; !a London[09:53] &lt;ec|ipse&gt;  ---=== Astro Information ===---[09:53] &lt;ec|ipse&gt; The time in London, GB is 09:53h. Time Zone Europe/London (Day) Day length 11:54h[09:53] &lt;ec|ipse&gt; The Sun: Sunrise at 06:12h and Sunset at 18:06h UV index Medium ☀️ Radiation 23.9W/m2 ☀️⚡ Energy 0.1kWh/m2[09:53] &lt;ec|ipse&gt; The Moon: Moonrise at 15:49h and Sunset at 06:06h Moon Phase Waxing Gibbous[09:53] &lt;BAYO&gt; !3 London[09:53] &lt;ec|ipse&gt; Three day forecast for London, England, United Kingdom (London)[09:53] &lt;ec|ipse&gt; Thu, 17 Mar - Partly cloudy throughout the day. Temp: 8°C Feels like: 7°C Min/Max: (3°C/13°C) Percip: 43%[09:53] &lt;ec|ipse&gt; Fri, 18 Mar - Clear conditions throughout the day. Temp: 9°C Feels like: 9°C Min/Max: (4°C/15°C) Percip: 0%[09:54] &lt;ec|ipse&gt; Sat, 19 Mar - Partly cloudy throughout the day. Temp: 8°C Feels like: 6°C Min/Max: (6°C/12°C) Percip: 0%[09:54] &lt;BAYO&gt; !g[09:54] &lt;ec|ipse&gt; Current weather: Sandanski 11°C /overcast clouds/ Varna 7°C /overcast clouds/ Sofia 8°C /broken clouds/ London 10°C /broken clouds/ Melbourne 21°C /broken clouds/</code></pre></div>&amp;&amp;&amp; some alerts as well to demo<br><div class="codebox"><p>Code: </p><pre><code>[09:55] &lt;BAYO&gt; !w Miami[09:55] &lt;ec|ipse&gt; Miami, US at the moment: 23°C Rain, Partially cloudy Sky ⛅ Partly Sunny Percip Prob 81% Humidity 78% Wind 8km/h from South-Southeast Wind gusts 16km/h Tomorrow: Min/Max (↓22°C/↑28C°)[09:55] &lt;ec|ipse&gt; Alerts: Rip Current Statement[09:55] &lt;ec|ipse&gt; [!Danger!] Rip Current Statement issued March 16 at 3:07AM EDT until March 16 at 8:00PM EDT by NWS Miami [From:] Wed, 16 Mar 2022 07:07 [To:] Thu, 17 Mar 2022 00:00</code></pre></div>If you want to change the cities by default in the group weather, please refer to this link where you open it and search for the locations you want and replace the city ID from the file. The part for edit is located @ The Second proc for the group cities by ID in the tcl. Enjoy!  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_lol.gif" width="15" height="15" alt=":lol:" title="Laughing"> <br><br>Link: <a href="https://www.mediafire.com/file/6q7yzhf8royd2vn/city.list.json/file" class="postlink">https://www.mediafire.com/file/6q7yzhf8 ... .json/file</a><br><div class="codebox"><p>Code: </p><pre><code>####################### @UniBG irc.chatpat.bg ## @FreeUniBG irc.interbg.org  ## Credits: MeMoreX &amp; SpiKe^^ ## Est: 01\2022 #######################namespace eval Visualcrossing {### Requirementspackage require jsonpackage require tlspackage require http### Bindingbind PUB -|- !g ::Visualcrossing::group_weatherbind PUB -|- !w ::Visualcrossing::pub_weatherbind PUB -|- !3 ::Visualcrossing::forecast_weatherbind PUB -|- !ww ::Visualcrossing::world_weather   ### The API Keys#OpenWeather @ https://openweathermap.org/ set appid ""#IpGeoLocation @ https://ipgeolocation.io/signup.htmlset apiKey ""#Visualcrossing @ https://visualcrossing.com/sign-upset key ""### Procedures start hereproc ::Visualcrossing::download_weather {url} {    ::http::register https 443 [list ::tls::socket -tls1 1]::http::config -useragent "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"set socket [http::geturl $url -timeout 5000]set items_data [http::data $socket]if {[http::status $socket] ne "ok" || [http::ncode $socket] != 200} {set code [http::code $socket]putlog "\00304***\003 Weather HTTP error: $code"putlog "\00304***\003 Request url is: $url"http::cleanup $socketreturn 0    }http::cleanup $socketreturn $items_data}### The Main Procproc ::Visualcrossing::pub_weather {nick uhost hand chan arg} {set items_data [::Visualcrossing::download_weather https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/weatherdata/forecast?[::http::formatQuery location $arg aggregateHours 24 forecastdays 3 includeAstronomy true locationMode lookup unitGroup metric shortColumnNames false contentType json alertLevel event lang en nonulls true key $::Visualcrossing::key]]if {$arg == ""} { putserv "PRIVMSG $chan :Syntax: !w city/location" ; return }### The Main Dictset connect[::json::json2dict $items_data]### The First Stack set locations [dict get $connect locations]set cityname [lindex $locations 0]set citydata [lindex $locations 1]set tz [dict get $citydata tz]set long [dict get $citydata longitude]set lat [dict get $citydata latitude]### The Second Stackset current [dict get $citydata currentConditions]if {$current != "null"} { set conditions $current }if {$current == "null" || $current == "" || $current == " "} { set currCond "No info but try again later." } else { set currCond $current }set wdir [join [::Visualcrossing::deg_to_dir [dict get $current wdir]]]set wspd [dict get $current wspd]if {$wdir eq "null" || $wdir eq "" || $wdir eq " "} { set windir "No info but try again later." } else { set windir $wdir }if {$wspd eq "null" || $wspd eq "" || $wspd eq " "} { set wspeed "None" } else { set wspeed [expr round($wspd)]km/h}if {$wspd ne "null"} {set wspd [expr round($wspd)]} set wgust [dict get $current wgust]if {$wgust eq "null" || $wgust eq "" || $wgust eq " "} { set wgustmsg "None" } else { set wgustmsg [expr round($wgust)]km/h}if {$wgust ne "null"} {set wgust [expr round($wgust)]}set temp [dict get $current temp]set temp [expr round($temp)]### The Third Stackset values [dict get $citydata values]set alert [dict get [lindex $values 0] alerts]if {$alert eq "null"} { set alertmsg "No" } else { set alertmsg $alert }set mint [dict get [lindex $values 1] mint]set mint [expr round($mint)]set maxt [dict get [lindex $values 1] maxt]set maxt [expr round($maxt)]set humi [dict get [lindex $values 0] humidity]set humi [expr round($humi)]set cond [dict get [lindex $values 0] conditions]set cloud [dict get [lindex $values 0] cloudcover]set pop [dict get [lindex $values 0] pop]set pop [expr round($pop)]### The Fourth Stackset sun_moon_data [::Visualcrossing::download_weather https://api.ipgeolocation.io/astronomy?[http::formatQuery apiKey $::Visualcrossing::apiKey location $arg]]if {$sun_moon_data == 0} { return }set sunmoon_dict [::json::json2dict $sun_moon_data]set sunrise [dict get $sunmoon_dict sunrise]set sunset [dict get $sunmoon_dict sunset]set current_time [string range [dict get $sunmoon_dict current_time] 0 4]if {$current_time &gt; $sunset} { set currtime "Night" } { set currtime "Day" }if {$cloud &lt; 10} {if {$currtime eq "Day"} { set sky "Sunny" } else { set sky "Clear" }} elseif {$cloud &lt; 20} {if {$currtime eq "Day"} { set sky "Sunny to Mostly Sunny" } else { set sky "Fair" }} elseif {$cloud &lt; 30} {if {$currtime eq "Day"} { set sky "Mostly Sunny" } else { set sky "Mostly Fair" }} elseif {$cloud &lt; 60} {if {$currtime eq "Day"} { set sky "\u26c5 Partly Sunny" } else { set sky "Partly Cloudy" }} elseif {$cloud &lt; 90} { set sky "Mostly Cloudy" } else { set sky "Cloudy" }#putlog "Day\Night -&gt; $currtime | CloudCover% -&gt; $cloud | Conditions -&gt; $cond | Sunset time: $sunset and Current time is $current_time ?"### The Fifth Stackset weather_data [::Visualcrossing::download_weather https://api.openweathermap.org/data/2.5/weather?[http::formatQuery q $arg appid $::Visualcrossing::appid lang us units metric]]if {$weather_data == 0} { return }set weather_dict [::json::json2dict $weather_data]set city [dict get $weather_dict name]set country [join [dict get $weather_dict sys country]]putserv "PRIVMSG $chan :\00307\002$city, $country\003\002 \00314at the moment: \00307$temp°C \00307$cond\003\ \00314Sky\003 \00307$sky\003 \00314Percip Prob \00307$pop\%\003 \00314Humidity \00307$humi\%\003 \00314Wind\003 \00307$wspeed \00314from \00307$wdir\003 \00314Wind gusts\003 \00307$wgustmsg\003 \00314Tomorrow: Min/Max (\003\00307↓$mint\°C\003\00314/\00307↑$maxt\C°\003\00314)\003"putserv "PRIVMSG $chan :\00314Alerts:\003 \00304$alertmsg\003"if {$alertmsg eq "No"} { return 0 }set alerts [dict get $citydata alerts]if {$alerts eq "null"} { return 0 }set head [dict get [lindex $alerts 0] headline]set onsetEpoch [dict get [lindex $alerts 0] onsetEpoch]set endsEpoch [dict get [lindex $alerts 0] endsEpoch]set ondate [clock format $onsetEpoch -format "%a, %e %b %Y %H:%M"]set offdate [clock format $endsEpoch -format "%a, %e %b %Y %H:%M"]putserv "PRIVMSG $chan :\[\00304!\003\00314Danger\00304!\003]\ \00304$head \003\[\00314From:\003]\00304 $ondate \003\[\00314To:\003]\00304 $offdate\003"}### The Second proc for the group cities by IDproc ::Visualcrossing::group_weather {nick uhost hand chan arg} {set group_data [::Visualcrossing::download_weather https://api.openweathermap.org/data/2.5/group?[http::formatQuery id 727447,726051,727011,2643743,7839805 appid $::Visualcrossing::appid lang us units metric]]if {$group_data == 0} { return }set group_dict [::json::json2dict $group_data]set cities [dict get $group_dict list]set cities_info ""foreach city $cities { set temp [dict get $city main temp]set temp [expr round($temp)]if {$temp &gt;=0} {set temp "$temp"}set name [dict get $city name]set des [dict get [lindex [dict get $city weather] 0] description]lappend cities_info "\00307$name \00304$temp°C\003 /\00314$des\003/" }putserv "PRIVMSG $chan :\00314Current weather:\003 [join $cities_info " "]" }### The Third proc for the group Top Largest Cities in the world by IDsproc ::Visualcrossing::world_weather {nick uhost hand chan arg} {set group_data [::Visualcrossing::download_weather https://api.openweathermap.org/data/2.5/group?[http::formatQuery id 1850147,1642911,1273294,1816670,3451190,1701668,1835847,5128638,3530597,360630,524894,2013159,745044,3435907,4887398,264371 appid $::Visualcrossing::appid lang en units metric]]if {$group_data == 0} { return }set group_dict [::json::json2dict $group_data]set world_cities [dict get $group_dict list]set world_cities_info ""foreach world_city $world_cities { set world_temp [dict get $world_city main temp]set world_temp [expr round($world_temp)]set wname [dict get $world_city name]set wdes [dict get [lindex [dict get $world_city weather] 0] description]lappend world_cities_info "\00307$wname \00304$world_temp°C\003 \00314($wdes)\003"}putserv "PRIVMSG $chan :\00314World Weather:\003 [join [lrange $world_cities_info 0 7] " "]"putserv "PRIVMSG $chan :[join [lrange $world_cities_info 8 15] " "]"}### Calculates the degrees from the API and converts them to words expresion like the string below### Attached to the Second Stack of the Main proc proc ::Visualcrossing::deg_to_dir {value} {       if {$value eq "null"} { return }set calc [expr ($value / 22.5) + 0.5]set dirs "North North-Northeast Northeast East-Northeast East East-Southeast Southeast South-Southeast South South-Southwest Southwest West-Southwest West West-Northwest Northwest North-Northeast"return [lindex $dirs [expr int($calc) % 16]]}### Sets the crontab expresion like the string belowproc ::Visualcrossing::auto_say {min hour day month week} {::Visualcrossing::group_weather "-" "-" "-" "#Forbidden" "-"}### Timer for making the weather posted in a channel, depends on the preference (refer to https://crontab.guru/)bind cron -|- "0 */6 * * *" ::Visualcrossing::auto_say### The Third Proc for 3 days Forecast proc ::Visualcrossing::forecast_weather {nick uhost hand chan arg} {set forecast_data [::Visualcrossing::download_weather https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/$arg/next3days?unitGroup=metric&amp;key=$::Visualcrossing::key]if {$arg == ""} { putserv "PRIVMSG $chan :Syntax: !3 city/location" ; return }set forecast_dict [::json::json2dict $forecast_data]set days_dict [dict get $forecast_dict days]set address [dict get $forecast_dict address]set raddress [encoding convertfrom utf-8 [dict get $forecast_dict resolvedAddress]]set three_list {}foreach day $days_dict {set temp [dict get $day temp]set temp [expr round($temp)]set feelslike [dict get $day feelslike]set feelslike [expr round($feelslike)]set tempmin [dict get $day tempmin]set tempmin [expr round($tempmin)]set tempmax [dict get $day tempmax]set tempmax [expr round($tempmax)]set desc [dict get $day description]set precipprob [dict get $day precipprob]set precipprob [expr round($precipprob)]lappend three_list "\002\00307[clock format [dict get $day datetimeEpoch] -format "%a, %e %b"]\002\003 - \00314$desc\003 \00314Temp\003: \00307$temp°C\003 \00314Feels like\003: \00307$feelslike°C\003 \00314Min/Max\003: \00307($tempmin°C/$tempmax°C)\003 \00314Percip\003: \00307$precipprob\%\003"         putserv "PRIVMSG $chan :\00314Three day forecast for \00307$raddress ($address)\003"}set three_list [lreplace $three_list 0 0]foreach t $three_list {putserv "PRIVMSG $chan :$t"}  }}namespace eval SunMoon {### Requirements package require jsonpackage require httppackage require tls### Binding bind PUB - !a ::SunMoon::pub_sun_moon### The API Keys#OpenWeather @ https://openweathermap.org/ set appid ""#IpGeoLocation @ https://ipgeolocation.io/signup.htmlset apiKey ""#Visualcrossing @ https://visualcrossing.com/sign-upset key ""### The Main Astro Proc proc ::SunMoon::download_data {url} {::http::register https 443 [list ::tls::socket -tls1 1]::http::config -useragent "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"set sun_moon [http::geturl $url -timeout 5000]set sun_moon_data [http::data $sun_moon]if {[http::status $sun_moon] ne "ok" || [http::ncode $sun_moon] != 200} {set code [http::code $sun_moon]putlog "\00304***\003 SunMoon HTTP error: $code"putlog "\00304***\003 Requested url is: $url"http::cleanup $sun_moonreturn 0}http::cleanup $sun_moon  return $sun_moon_data}proc ::SunMoon::pub_sun_moon {nick uhost hand chan arg} {if {$arg == ""} { putserv "PRIVMSG $chan :Syntax: !a city/location" ; return }set sun_moon_data [::SunMoon::download_data https://api.ipgeolocation.io/astronomy?[http::formatQuery apiKey $::SunMoon::apiKey location $arg]]if {$sun_moon_data == 0} { return }set sunmoon_dict [::json::json2dict $sun_moon_data]set current_time [string range [dict get $sunmoon_dict current_time] 0 4]set sunrise [dict get $sunmoon_dict sunrise]set sunset [dict get $sunmoon_dict sunset]set daylength [dict get $sunmoon_dict day_length]set moonrise [dict get $sunmoon_dict moonrise]set moonset [dict get $sunmoon_dict moonset]set moon_status [dict get $sunmoon_dict moon_status]if {$current_time &gt; $sunset} { set currtime "Night" } { set currtime "Day" }set items_data [::SunMoon::download_data https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/weatherdata/forecast?[::http::formatQuery location $arg aggregateHours 24 forecastDays 3 includeAstronomy true locationMode lookup unitGroup metric shortColumnNames false contentType json alertLevel event lang en nonulls true key $::SunMoon::key]]### The Main Astro Dictset connect[::json::json2dict $items_data]###The First Astro Stack set locations [dict get $connect locations]set cityname [lindex $locations 0]set citydata [lindex $locations 1]set tz [dict get $citydata tz]## The Second Astro Stackset current [dict get $citydata currentConditions]set moon [dict get $current moonphase]if {$moon eq 0 || $moon eq 1} {  set phase "New Moon"} elseif {$moon &lt; 0.25} {  set phase "Waxing Crescent"} elseif {$moon eq 0.25} {  set phase "First Quarter"} elseif {$moon &lt; 0.5} {  set phase "Waxing Gibbous"} elseif {$moon eq 0.5} {  set phase "Full Moon"} elseif {$moon &lt; 0.75} {  set phase "Waning Gibbous"} elseif {$moon eq 0.75} {  set phase "Last Quarter"} elseif {$moon &lt; 1} {  set phase "Waning Crescent"} else {  set phase "Error. Unknown."}### The Third Astro Stackset values [dict get $citydata values]set uv [dict get [lindex $values 0] uvindex]if {$uv eq 0 || $uv eq 1 || $uv eq 2 || $uv eq 3 || $uv eq 4}  {set index "Low"}elseif {$uv&lt;5 || $uv eq 6}  {set index "Medium"}elseif {$uv&lt;7 || $uv eq 8}  {set index "High"}elseif {$uv&lt;9 || $uv eq 10} {set index "Very High"}elseif {$uv&gt;11} {set index "Extreme"}else {set index "Error. Unknown"}set radiation [dict get [lindex $values 0] solarradiation]set energy [dict get [lindex $values 0] solarenergy]### The Fourth Astro Stackset weather_data [::SunMoon::download_data https://api.openweathermap.org/data/2.5/weather?[http::formatQuery q $arg appid $::SunMoon::appid lang us units metric]]if {$weather_data == 0} { return }set weather_dict [::json::json2dict $weather_data]set city [dict get $weather_dict name]set country [join [dict get $weather_dict sys country]]putserv "PRIVMSG $chan :\002\00314 ---=== Astro Information ===---\003\002"putserv "PRIVMSG $chan :\00314The time in \00307\002$city, $country\003\002 \00314is \00307$current_time\h.\003 \00314Time Zone\003 \00307$tz ($currtime) \003\00314Day length\003 \00304$daylength\h"putserv "PRIVMSG $chan :\00314The Sun: \00307Sunrise\003 \00314at \00304$sunrise\h\003 \00314and\003 \00307Sunset \00314at \00304$sunset\h\003 \00307UV index \00304$index\003 ☀️ \00314Radiation \00304$radiation\W/m2\003 ☀️\u26a1 \00314Energy \00304$energy\kWh/m2\003"putserv "PRIVMSG $chan :\00314The Moon: \00307Moonrise\003 \00314at \00304$moonrise\h\003 \00314and\003 \00307Sunset \00314at \00304$moonset\h\00307 Moon Phase \00304$phase\003"}}### Lastly, help section on NOTICE for a bit more information### Bindingbind pub -|- !weather pub:helpproc pub:help {nick uhost hand chan text} {global botnickif {[llength $text]&lt;1} {putserv "NOTICE $nick :----------==========\002Weather Commands\002==========--------------"putserv "NOTICE $nick :!w city/location - Shows current weather conditions."putserv "NOTICE $nick :!a city/location - Shows astronomy information"putserv "NOTICE $nick :!g Shows info for cities IDs as a group from API endpoint."        putserv "NOTICE $nick :!ww Shows the weather for the largest cities in the world"putserv "NOTICE $nick :!3 city/location - Three days forecast."}}putlog "The complete Weather Tcl ...Loaded"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12958">bayo</a> — Wed Mar 16, 2022 1:24 pm</p><hr />
]]></content>
	</entry>
	</feed>
