Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxpatternman/072e20ea06d3a095ecd37f05a2803ac3 to your computer and use it in GitHub Desktop.
Save maxpatternman/072e20ea06d3a095ecd37f05a2803ac3 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
#!/usr/bin/env 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
BOT_TOKEN=''
CHANNELID=''
curl -v \
-H "Authorization: ${BOT_TOKEN}" \
-H "User-Agent: myBotThing (http://some.url, v0.1)" \
-H "Content-Type: application/json" \
-X POST \
-d "{\"content\":\"${1}\"}" \
https://discordapp.com/api/channels/${CHANNELID}/messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment