Probably been asked, and I don't want to fish out the commands and functions from Geek's Discord.ahk.
What is the "mini-script" that sends a message to a specified channel of Discord?
Send Message to Discord Using API Topic is solved
- Delta Pythagorean
- Posts: 628
- Joined: 13 Feb 2017, 13:44
- Location: Somewhere in the US
- Contact:
Send Message to Discord Using API
[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat
- Delta Pythagorean
- Posts: 628
- Joined: 13 Feb 2017, 13:44
- Location: Somewhere in the US
- Contact:
Re: Send Message to Discord Using API Topic is solved
Nevermind I had the code in a file.
I'm stupid.
I'm stupid.
Code: Select all
Text := StrReplace(StrReplace(Text, "\", "\\"), """", "\""")
Http := ComObjCreate("WinHTTP.WinHTTPRequest.5.1")
Http.Open("POST", "https://discordapp.com/api/channels/" ChanID "/messages")
Out := Http.Open("GET", "https://discordapp.com/api/channels/" ChanID)
Http.SetRequestHeader("Authorization", Token)
Http.SetRequestHeader("Content-Type", "application/json")
Http.Send("{""content"": """ Text """}")
[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat
Re: Send Message to Discord Using API
I've set up a discord bot, joined it to my server. In your code I replaced ChanID with my channel ID, the Token with my bot's token, and put in my own text. When I try to send a test message I don't get an error, but no message is sent. Is there something else I'm missing?
Re: Send Message to Discord Using API
Ive been trying to figure this out but I cant get it to work, can you send some example code that works to send a message to discord webhook?
-
- Posts: 40
- Joined: 12 Jun 2021, 15:28
Re: Send Message to Discord Using API
Delta, I've tried setting it up too but it won't send really, and g33kdude says that Discord.ahk is probably outdated since the api has changed, so it might be that, do you have perhaps an updated version? or an updated version of discord.ahk?
Who is online
Users browsing this forum: JKJadan and 258 guests