-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
Entitlements updates #1186
base: master
Are you sure you want to change the base?
Entitlements updates #1186
Conversation
key2peace
commented
Oct 20, 2023
•
edited
Loading
edited
- awaits Update InteractionResponseType.php discord/discord-interactions-php#8
since it is linked, things should be easier
since it is linked, things should be easier
use get instead of cacheget
use get instead of cacheGet
Change endpoints
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 have yet to review the codes from IDE for static analytic, and test locally for runtime (not the actual implementation)
if ($entitlementPart = $this->discord->application->entitlements->get('id', $entitlement->id)) { | ||
$entitlementPart->fill((array) $entitlement); | ||
} else { | ||
$this->discord->application->entitlements->set($entitlement->id, $this->discord->application->entitlements->create($entitlement, true)); |
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.
Since it's not available in my region, I just want to be sure that the entitlement received here is ONLY the entitlement belongs to the bot's application, and not to other's application (can you compare for application_id first to be safe?)
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.
as per https://discord.com/developers/docs/monetization/entitlements#entitlement-resource thats already the case
Co-authored-by: SQKo <[email protected]>
Co-authored-by: SQKo <[email protected]>
Co-authored-by: SQKo <[email protected]>
Co-authored-by: SQKo <[email protected]>
Co-authored-by: SQKo <[email protected]>
Co-authored-by: SQKo <[email protected]>
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.
Why is this returning Collection? Isn't repository get()
returns Part|null
?
src/Discord/Parts/Guild/Guild.php
Outdated
* @link https://discord.com/developers/docs/monetization/entitlements#list-entitlements | ||
* | ||
* @return Collection[]|Entitlement[] | ||
*/ | ||
public function getMyApplicationEntitlement(): Collection | ||
{ | ||
return $this->discord->application->entitlements->get('guild_id', $this->id); |
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.
.
src/Discord/Parts/User/User.php
Outdated
* @return Collection[]|Entitlement[] | ||
*/ | ||
public function getMyApplicationEntitlement(): Collection | ||
{ | ||
return $this->discord->application->entitlements->get('user_id', $this->id); |
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.
.
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 don't think this is part of Interactions
Shouldn't this be part of Monetization (as per Discord's doc resource) or Application (as per the endpoint)?
* with this source code in the LICENSE.md file. | ||
*/ | ||
|
||
namespace Discord\Parts\Interactions; |
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.
.
* with this source code in the LICENSE.md file. | ||
*/ | ||
|
||
namespace Discord\Repository\Interaction; |
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.
.
$entitlementPart = $oldEntitlement; | ||
$oldEntitlement = clone $oldEntitlement; | ||
|
||
$entitlementPart->fill((array) $data); |
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.
missing async cache update
I believe this now needs to be re-reviewed and the 'wait for discord' label removed. |