`treehouses message discord` new subcommands using Oauth-Bot/Websockets (fixes #2154)
This PR is similar to #2151 but instead of a user-token, a Bot token would be used to access the discord client and webhooks would be used to send messages to your channel.
NOTE: To send a message to your chosen channel, make sure you are the owner of the server and have a webhook integrated to that channel. See https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks for setting up a webhook.
When I don't have the client ID, the following commands will return jq errors instead of a custom error handler:
./cli.sh message discord channels "CHAOS SERVER"./cli.sh message discord send "CHAOS SERVER" "rules" "test"
Yah, I should've been more explicit in the instructions that you need a client id set up before using the communication commands. Or I could create an error handler 🤔
The script is still buggy, but to send message with the websocket replacement:
- Run
./cli.sh message discord apitoken <your bot token> - Run
./cli.sh message discord authorize <your client id> - Run
./cli.sh message discord ws<- to enable sending messages (this is not a feature; will be refactored later)
Then the rest of the commands are the same from the discord apitoken branch.
