<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Telegram bot API]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=16624</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=16624&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Telegram bot API».]]></description>
		<lastBuildDate>Wed, 29 Sep 2021 07:39:03 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Telegram bot API]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=149789#p149789</link>
			<description><![CDATA[<p>Справился сам, однако сам текст не выводится: <span class="postimg"><img src="https://i.imgur.com/ScuAcEN.png" alt="https://i.imgur.com/ScuAcEN.png" /></span><br /></p><div class="codebox"><pre><code>#include json.ahk					; include to process JSON strings as objects

token := &quot;токен&quot;

q::		; press q to get updates
update := GetUpdates(token, , 1)				; limit result to 1 message
oUpd := JSON.Load(update)		; load JSON response string as an AHK object
msgbox % update

return

Esc::ExitApp

GetUpdates(botToken, offset=&quot;&quot;, updlimit=100, timeout=0){							
	If (updlimit&gt;100)
		updlimit := 100
	; Offset = Identifier of the first update to be returned.
	url := &quot;https://api.telegram.org/bot&quot; botToken &quot;/getupdates?offset=&quot; offset &quot;&amp;limit=&quot; updlimit &quot;&amp;timeout=&quot; timeout
	updjson := URLDownloadToVar(url)					
	return updjson
}

URLDownloadToVar(url,ByRef variable=&quot;&quot;){			
	try
	{	
		hObject:=ComObjCreate(&quot;WinHttp.WinHttpRequest.5.1&quot;)
		hObject.Open(&quot;GET&quot;,url)
		hObject.Send()
		variable:=hObject.ResponseText
		return variable
	}
}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (AterEX)]]></author>
			<pubDate>Wed, 29 Sep 2021 07:39:03 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=149789#p149789</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Telegram bot API]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=149787#p149787</link>
			<description><![CDATA[<p>Тогда лучше в той теме и спросили бы. Здесь я не припомню, чтобы кто-то этим занимался.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Tue, 28 Sep 2021 19:31:57 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=149787#p149787</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Telegram bot API]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=149786#p149786</link>
			<description><![CDATA[<p><strong>teadrinker</strong>Скрипт для отправки сообщений я сделал по исходникам, исходник для чтения сообщений я нашел, но он у меня не работает, плюс этот уровень кодинга довольно выше моего, соответственно я не все понимаю: https://www.autohotkey.com/boards/viewtopic.php?f=76&amp;t=42031#p192355</p>]]></description>
			<author><![CDATA[null@example.com (AterEX)]]></author>
			<pubDate>Tue, 28 Sep 2021 18:46:28 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=149786#p149786</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Telegram bot API]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=149785#p149785</link>
			<description><![CDATA[<p>Если сумели написать скрипт для отправки сообщений, в чём проблема написать для чтения?</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Tue, 28 Sep 2021 18:01:41 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=149785#p149785</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Telegram bot API]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=149784#p149784</link>
			<description><![CDATA[<p>Приветствую. Я сделал скрипт, который заставляет писать бота в телеграм, как мне сделать так,&nbsp; чтобы бот мог читать мои сообщения через ахк?<br /></p><div class="codebox"><pre><code> bot_token := &quot;токен&quot;
            Global chat_id := чат ид
            Global msg_api := Format(&quot;https://api.telegram.org/bot{1}/sendMessage&quot;, bot_token)
            
            PostMsg(clipboard)
            
            PostMsg(msg_text)
            {
                WinHttpObj := ComObjCreate(&quot;WinHttp.WinHttpRequest.5.1&quot;)
                WinHttpObj.Open(&quot;POST&quot;, msg_api)
                WinHttpObj.SetRequestHeader(&quot;User-Agent&quot;, &quot;Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0&quot;)
                WinHttpObj.SetRequestHeader(&quot;Content-Type&quot;, &quot;application/json; charset=UTF-8&quot;)
                mJson := Format(&quot;{ &quot;&quot;chat_id&quot;&quot;: &quot;&quot;{1}&quot;&quot;, &quot;&quot;text&quot;&quot;: &quot;&quot;{2}&quot;&quot;, &quot;&quot;parse_mode&quot;&quot; : &quot;&quot;{3}&quot;&quot; }&quot;, chat_id, msg_text, parse_mode)
                WinHttpObj.Send(mJson)
            }</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (AterEX)]]></author>
			<pubDate>Tue, 28 Sep 2021 17:49:13 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=149784#p149784</guid>
		</item>
	</channel>
</rss>
