Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save maxpatternman/072e20ea06d3a095ecd37f05a2803ac3 to your computer and use it in GitHub Desktop.
Save maxpatternman/072e20ea06d3a095ecd37f05a2803ac3 to your computer and use it in GitHub Desktop.

Revisions

  1. maxpatternman revised this gist Mar 1, 2018. 1 changed file with 8 additions and 5 deletions.
    13 changes: 8 additions & 5 deletions discord-bot-post-message.sh
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,16 @@
    #!/bin/bash
    #!/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
    # use a library like discord.py to do so

    BOT_TOKEN=''
    CHANNELID=''

    curl -v \
    -H "Authorization: Bot TOKEN" \
    -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
    -d "{\"content\":\"${1}\"}" \
    https://discordapp.com/api/channels/${CHANNELID}/messages
  2. @ianklatzco ianklatzco created this gist Dec 29, 2016.
    13 changes: 13 additions & 0 deletions discord-bot-post-message.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    #!/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