<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Discord API Отправка сообщений, используя Token]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=17269</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=17269&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Discord API Отправка сообщений, используя Token».]]></description>
		<lastBuildDate>Mon, 25 Jul 2022 17:35:18 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Discord API Отправка сообщений, используя Token]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=154050#p154050</link>
			<description><![CDATA[<p><strong>Clannad5</strong>, апишка, которая находится по ссылке, работает с сервером. Не вижу там ни одной функции, которая помогла бы решить вашу задачу. Самое близкое - SendMessage(), но она работает с каналами. Если у вас задача отправлять что-то одному пользователю, то можно добавить его на сервер и выделить ему его личный канал, тогда можно попробовать что-то такое:<br /></p><div class="codebox"><pre><code>
#include Discord.ahk ; Подключаем апи дискорда, нужно указать путь, если не в папке скрипта

Discord._New(*сюда токен бота дискорда*) ; Инициализация бота

Discord.SendMessage(*айди канала*, &quot;Текст&quot;) ; Отправка текста

</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Madmer)]]></author>
			<pubDate>Mon, 25 Jul 2022 17:35:18 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=154050#p154050</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Discord API Отправка сообщений, используя Token]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=154049#p154049</link>
			<description><![CDATA[<p>Здравствуйте!</p><p>Пытался найти тему на форуме, с моей проблемой.<br />Суть заключается в чём..</p><p>нужно отправлять, с помощью AHK, сообщения в Discord пользователя, посредством `WebRequest`, то есть без наличия Discord приложения.<br />Хотелось бы хоть какого-нибудь примера для отправки в личку пользователю.<br />Спасибо!</p><p>Нашел вот это: <a href="https://github.com/G33kDude/Discord.ahk/blob/master/Discord.ahk">https://github.com/G33kDude/Discord.ahk … iscord.ahk</a>, но я без понятия как с ним работать <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" />.</p><p>UPD:<br />Нашел решение попроще.<br />1. Создаем Discord чат канал.<br />2. Зайти в &quot;Настроить канал&quot;.<br />3. Интеграция -&gt; Вебхуки -&gt; Новый вебхук<br />4. Даём имя и выбираем канал где будет наш бот.<br />5. копируем URL полученного вебхука.</p><p>Интегрируем данный вебхук в этот код:</p><div class="codebox"><pre><code>
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

;Credit: https://www.reddit.com/r/AutoHotkey/comments/gybnyu/discord_webhook_post_fancy_edition/
;User Settings -&gt; Notifications -&gt; Push Notification Inactive Timeout: 1 minute
;Turn on Discord Developer Mode: User Settings -&gt; Appearance -&gt; Scroll to bottom and check developer mode
;Make sure to disable streamer mode User Settings -&gt; Streamer Mode -&gt; Disable
		;This allows you to copy User/Server IDs when you right Click
		;Use that ID in your content message as &lt;@USERID&gt; to do @mentions
		;` Example: &lt;@12345678910112&gt; or &lt;#channelID&gt;
	  ;Generate webhook for channel

sendError(&quot;cutting trees&quot;)

sendError(msg){
	url:=&quot;СЮДА ВАШУ ССЫЛКУ&quot; ; use the url from Discord webhook bot
	postdata=
	(
	{
	  &quot;content&quot;: &quot;СЮДА ВАШ ТЕКСТ ИЛИ %ПЕРЕМЕННУЮ%.&quot;
	}
	)
	
	WebRequest := ComObjCreate(&quot;WinHttp.WinHttpRequest.5.1&quot;)
	WebRequest.Open(&quot;POST&quot;, url, false)
	WebRequest.SetRequestHeader(&quot;Content-Type&quot;, &quot;application/json&quot;)
	WebRequest.Send(postdata)  
}
</code></pre></div><p>Источник: <a href="https://www.reddit.com/r/AutoHotkey/comments/gybnyu/discord_webhook_post_fancy_edition/">https://www.reddit.com/r/AutoHotkey/com … y_edition/</a></p>]]></description>
			<author><![CDATA[null@example.com (Clannad5)]]></author>
			<pubDate>Mon, 25 Jul 2022 16:23:17 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=154049#p154049</guid>
		</item>
	</channel>
</rss>
