Added app command fields#48
Conversation
…lyjitter/nosedrum into feature/all_app_command_flags
|
Oops, the removal of global handling was a last minute change. I'll fix that real quick. |
jchristgit
left a comment
There was a problem hiding this comment.
Hello, thank you for the PR!
A breaking change was made to improve default_member_permissions: permissions are now converted to bitset on the nosedrum end, so library users only need to pass a simple list of permissions atoms. This should be a better interface (and was done as a part of the abovementioned build_payload refactor).
If backwards-compatibility is desired, it should be trivial to introduce that.
Yes, let's please introduce backwards compatibility here. We can log a warning if this is passed and remove it completely from the documentation.
Other than that this looks good - thank you very much!
lib/nosedrum/application_command.ex
Outdated
| def contexts, do: [:guild, :private_channel, :bot_dms] | ||
| ``` | ||
| """ | ||
| @callback contexts() :: [:guild | :bot_dms | :private_channel] |
There was a problem hiding this comment.
I'm not really sure if Dialyzer will understand this as it's meant. I think right now it may be interpreted as an improper list with three elements. I think we should maybe move the atoms into a different @type context :: :bot_dms | :guild | :private_channel
lib/nosedrum/application_command.ex
Outdated
| def integration_types, do: [:guild_install, :user_install] | ||
| ``` | ||
| """ | ||
| @callback integration_types() :: [:guild_install | :user_install] |
jchristgit
left a comment
There was a problem hiding this comment.
Sorry, I didn't see that you pushed new commits. Looks good to me. Thank you!
This PR adds the following application command fields, which were missing before:
It also refactors build_payload to be more extensible and maintainable for any future API changes that may occur. This was a necessity to support the new fields.
A breaking change was made to improve default_member_permissions: permissions are now converted to bitset on the nosedrum end, so library users only need to pass a simple list of permissions atoms. This should be a better interface (and was done as a part of the abovementioned build_payload refactor).
If backwards-compatibility is desired, it should be trivial to introduce that.
After considerable testing, I was able to confirm that if a field isn't explicitly passed during creation or update, Discord WILL set it to the internal default, so I documented the defaults in the new documentation.
Finally, this PR does not include support for name and description localization; although I hope to add that, there's some gaps for it in nostrum. I'm working on filling that in before I make a PR for those.
Feel free to critique as needed 😊 Thank you!