Introduce optional API calling to RestInteraction #2281
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In a previous PR (#2276) I opted to implement a number of breaking changes to achieve the same result as in this PR. After serious revision, I decided to completely revert this approach and start over. Considering the amount of data passed over interactions, even partial objects are enough to populate interactions enough to be functional, even for the interaction service.
Changes
This PR does not break anything for users that plan on keeping this behavior. A new configuration option has been introduced at Rest level to allow users to disable API calls on interaction creation.
The properties
Channel
andGuild
will be null as a result of the above, and some values from app-commandData
will not be fully populated. There is no way around this, even if we turn the properties lazy. These calls were forced on creation, there would be no point to lazy calling because it would be done directly.ChannelId
andGuildId
have been introduced to be able to manually make API calls if desired.