-
Notifications
You must be signed in to change notification settings - Fork 14
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
Change from many create_*_application_command requests to a single bulk_overwrite_*_application_commands request #34
Changes from all commits
0c6d75a
dce8726
b976c54
e196c7c
1b58fde
d7119d7
961d3f1
df29d71
1aaf165
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,11 +84,29 @@ defmodule Nosedrum.Storage do | |
| {:error, :unknown_command} | ||
| Nostrum.Api.error() | ||
|
||
@doc """ | ||
Queues a new command to be registered under the given name or application command path. Queued commands are | ||
added to the internal dispatch storage, and will be registered in bulk upon calling process_queue/1 | ||
|
||
If any command already exists, it will be overwritten. | ||
|
||
## Return value | ||
Returns `:ok` if successful, and `{:error, reason}` otherwise. | ||
""" | ||
@callback queue_command( | ||
name_or_path :: String.t() | application_command_path, | ||
command_module :: module, | ||
name_or_pid | ||
) :: :ok | {:error, Nostrum.Error.ApiError.t()} | ||
|
||
@doc """ | ||
Add a new command under the given name or application command path. | ||
|
||
If the command already exists, it will be overwritten. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we document here that when many commands are being registered, it is recommended to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, good idea. |
||
|
||
When adding many commands, it is recommended to use queue_command, and to call process_queue once all | ||
commands are queued for registration. | ||
|
||
## Return value | ||
Returns `:ok` if successful, and `{:error, reason}` otherwise. | ||
""" | ||
|
@@ -115,6 +133,19 @@ defmodule Nosedrum.Storage do | |
name_or_pid | ||
) :: :ok | {:error, Nostrum.Error.ApiError.t()} | ||
|
||
@doc """ | ||
Register all currently queued commands to discord, making them available for use | ||
|
||
Global commands can take up to 1 hour to be made available. Guild commands are available immediately. | ||
|
||
## Return value | ||
Returns `:ok` if successful, and `{:error, reason}` otherwise. | ||
""" | ||
@callback process_queue( | ||
scope :: command_scope, | ||
name_or_pid | ||
) :: :ok | {:error, Nostrum.Error.ApiError.t()} | ||
|
||
@doc """ | ||
Responds to an Interaction with the given `t:Nosedrum.ApplicationCommand.response/0`. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should update the documentation for this to read that it adds the command to the internal dispatch storage, but does not yet send it to Discord, and also that
process_queued_commands
should be used once all desired commands have been added.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be happy to. I'm new to contributing to open source, and relatively new to elixir compared to you guys, so if there's any steps other than just updating the doc comments, let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, just updating the doc comment would be enough 🙂