Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
sends a message to a discord channel via a bot using command line HTTP POST- curl
#!/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
@j-l-s

This comment has been minimized.

Copy link

@j-l-s j-l-s commented Mar 20, 2020

Thanks for the script.

A way to get the channel URL is to create and use a discord's webhook:

@k1msho

This comment has been minimized.

Copy link

@k1msho k1msho commented May 14, 2020

How i get the channel id url?

@Justintime50

This comment has been minimized.

Copy link

@Justintime50 Justintime50 commented Dec 3, 2020

@k1msho In The Discord application go to Settings > Appearance > Check developer mode. Right click channel name and copy the channel ID (Copy ID).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment