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

add support for commands and interactions #38

Merged
merged 7 commits into from
Nov 17, 2022
Merged

add support for commands and interactions #38

merged 7 commits into from
Nov 17, 2022

Conversation

switchupcb
Copy link
Owner

@switchupcb switchupcb commented Nov 16, 2022

Adds tested support for slash commands.

Addresses: #11, #31

Application Command Examples

  • Basic Command
  • Subcommands
  • Options
  • Localization
  • Autocomplete
  • Interaction Response (Basic)
  • Edit Interaction Response
  • Follow-up Message Response
  • Edit Follow-up Message Response

Tools

  • InterceptSIGINT: Program waits until termination from terminal.

fixes marshal and unmarshal semantics
go mod tidy examples
update readme example
@switchupcb switchupcb changed the title add support for slash commands add support for commands and interactions Nov 16, 2022
includes subcommand groups, options
@switchupcb
Copy link
Owner Author

Based on the information provided in Interactions: Security and Authorization verification only applies to bots that receive interactions via outgoing webhook. The criteria for an outgoing webhook is defined here. Currently, Disgo supports the first method of the two mutually exclusive methods to receive interactions.

Implementing outgoing webhooks requires three steps.

  1. The user must set the "Interactions Endpoint URL" setting in the Developer Portal.
  2. That endpoint must be prepared to ACK a PING message. It's unclear whether Disgo should provide support for this directly (through the API Wrapper) given the following.
    • There is category of interaction-webhook libraries such that this logic may indicate more than the implementation of all requests (against).
    • All webhook requests are already implemented in Disgo (for).
    • Based on Tempest, all that would be needed is a server which is less complexity than the implemented Discord Gateway (neutral).
    • The Discord Gateway allows Disgo users to respond to interactions already (against).
  3. The endpoint must handle signature headers upon each interaction.

Implementation

Implementation for this feature is straightforward.

  1. Add a PublicKey field to client.
  2. Determine whether webhooks interactions are bound by rate limits. If not, add those endpoints to the IgnoreGlobalRateLimitRouteIDs map in ratelimit.go.
  3. Add a server to webhook.go which receives requests and verifies the headers of incoming requests.
  4. Add tests and examples.

In any case, that feature is currently beyond the scope of this pull request such that its target will be moved to the next release.

fix webhook thread id fields
lint examples manually
@switchupcb switchupcb temporarily deployed to testing November 17, 2022 08:36 Inactive
@switchupcb switchupcb merged commit 1f9e4a0 into v10 Nov 17, 2022
@switchupcb switchupcb deleted the commands branch November 29, 2022 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant