<?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/20954" />

	<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>2021-04-10T18:04:07-04:00</updated>

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

		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2021-04-10T18:04:07-04:00</updated>

		<published>2021-04-10T18:04:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109728#p109728</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109728#p109728"/>
		<title type="html"><![CDATA[Using format]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109728#p109728"><![CDATA[
<blockquote class="uncited"><div>5) DON'T UNREGISTER THE https PROTOCOL.<br>It will break other scripts.</div></blockquote>In a perfect world, every script using https must register https protocol on demand and unregister it when finishing with http.<br>You instanciate http each time, so you register https each time. And unregister when closing your connection.<br><br>If all scripts were done using this small rule, everything will be ok.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Sat Apr 10, 2021 6:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ComputerTech]]></name></author>
		<updated>2021-04-10T10:30:38-04:00</updated>

		<published>2021-04-10T10:30:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109727#p109727</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109727#p109727"/>
		<title type="html"><![CDATA[Using format]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109727#p109727"><![CDATA[
First Hiya DasBrain <br><br>Second: no i want fhe script to have + between city name and , before country name (if specified)<br><br>something like this<div class="codebox"><p>Code: </p><pre><code>set ctw(location) [join $text ,]</code></pre></div>but somehow keep + between cities and then , at the end, dunno how the best way to specify the end of the city name, but all ideas are welcome <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><br><br>EDIT<br><br>and yeah i know you're suppose to put , between city and country names, although i found out by using + between city name, and , at the end, works better <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12849">ComputerTech</a> — Sat Apr 10, 2021 10:30 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DasBrain]]></name></author>
		<updated>2021-04-10T08:55:49-04:00</updated>

		<published>2021-04-10T08:55:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109726#p109726</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109726#p109726"/>
		<title type="html"><![CDATA[Using format]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109726#p109726"><![CDATA[
1) What do you want your trigger to look like?<br><br>Really just "!w los+angeles, United States"?<br><br>2) The API is described here:<br><a href="https://openweathermap.org/current" class="postlink">https://openweathermap.org/current</a><br><br>Use [http::geturl <a href="http://api.openweathermap.org/data/2.5/weather" class="postlink">http://api.openweathermap.org/data/2.5/weather</a>?[http::formatQuery ...]], as the API seems to look like it uses GET requests.<br><br>3) Don't cleanup $data, cleanup the result of [http::geturl]<br><br>4) Use callbacks - [http::geturl -command]<br><br>5) DON'T UNREGISTER THE https PROTOCOL.<br>It will break other scripts.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12909">DasBrain</a> — Sat Apr 10, 2021 8:55 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ComputerTech]]></name></author>
		<updated>2021-04-10T00:15:13-04:00</updated>

		<published>2021-04-10T00:15:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=109725#p109725</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=109725#p109725"/>
		<title type="html"><![CDATA[Using format]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=109725#p109725"><![CDATA[
Hey, so i am trying to make it possible for this<div class="codebox"><p>Code: </p><pre><code>!w los+angeles, United States</code></pre></div>i need + between city name and , at the end (before country)<div class="codebox"><p>Code: </p><pre><code>package require jsonpackage require tlspackage require httpset ctw(api) "YOUR-API-KEY-HERE"bind PUB - "!w" weather:callproc weather:call {nick host hand chan text} {   global ctw  http::register https 443 [list ::tls::socket]  set uargs [http::formatQuery q [lindex [split $text] 0] units=metric appid=$ctw(api)]         set data [http::data [http::geturl "http://api.openweathermap.org/data/2.5/weather?" -query $uargs -timeout 10000]]  http::cleanup $data  http::unregister https         set data2 [::json::json2dict $data]         set name [dict get $data2 "name"]         set sys [dict get $data2 "sys"]         set country [dict get $sys "country"]         set main [dict get $data2 "main"]         set temp [dict get $main "temp"]         set humidity [dict get $main "humidity"]         set wind [dict get $data2 "wind"]        set speed [dict get $wind "speed"]        set current [dict get [lindex [dict get $data2 weather] 0] description]                    putserv "PRIVMSG $chan :\[\00309Weather\003\] ${name}, $country | ${temp}$ctw(met2) | ${speed}$ctw(met3) | $current | ${humidity}%"}</code></pre></div>so i was trying formatQuery, am i close to right?  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_lol.gif" width="15" height="15" alt=":lol:" title="Laughing"> <br><br>Thanks in advanced<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12849">ComputerTech</a> — Sat Apr 10, 2021 12:15 am</p><hr />
]]></content>
	</entry>
	</feed>
