Created
December 29, 2016 02:36
-
-
Save ianklatzco/c033b33757915feaf48fd0caf14b42cb to your computer and use it in GitHub Desktop.
sends a message to a discord channel via a bot using command line HTTP POST- curl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# update the TOKEN and the CHANNELID, rest is optional | |
# you may need to connect with a websocket the first time you run the bot | |
# use a library like discord.py to do so | |
curl -v \ | |
-H "Authorization: Bot TOKEN" \ | |
-H "User-Agent: myBotThing (http://some.url, v0.1)" \ | |
-H "Content-Type: application/json" \ | |
-X POST \ | |
-d '{"content":"Posting as a bot"}' \ | |
https://discordapp.com/api/channels/CHANNELID/messages |
How i get the channel id url?
@k1msho In The Discord application go to Settings > Appearance > Check developer mode. Right click channel name and copy the channel ID (Copy ID).
tnx
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the script.
A way to get the channel URL is to create and use a discord's webhook:
(the URL looks like: https://discordapp.com/api/webhooks/162930455b6v7s8b9jjvsabcvkbvsnmNI1GvxKjO5JH)
no need of websocket or whatever another authentication