Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treehouses message discord new subcommands using Oauth-Bot/Websockets (fixes #2154) #2155

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

rjpadilla
Copy link
Member

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.

JLKwong
JLKwong previously requested changes Apr 2, 2021
Copy link
Member

@JLKwong JLKwong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

image

@rjpadilla
Copy link
Member Author

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"

image

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 🤔

@rjpadilla rjpadilla changed the title treehouses message discord new subcommands using Oauth-Bot/Webhooks (fixes #2154) treehouses message discord new subcommands using Oauth-Bot/Websockets (fixes #2154) Apr 5, 2021
Copy link
Member Author

@rjpadilla rjpadilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this new code, if you want to send a message you'll need to use the message discord ws after setting and authorizing your token plus have wscat installed.

@rjpadilla rjpadilla requested review from dogi and JLKwong April 8, 2021 00:35
@rjpadilla
Copy link
Member Author

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.

@dogi dogi dismissed JLKwong’s stale review February 14, 2023 02:33

it got fixed ... maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants