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

Entitlements updates #1186

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open

Entitlements updates #1186

wants to merge 30 commits into from

Conversation

key2peace
Copy link
Collaborator

@key2peace key2peace commented Oct 20, 2023

Copy link
Member

@SQKo SQKo left a 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)

src/Discord/Parts/Guild/Guild.php Show resolved Hide resolved
src/Discord/Parts/Interactions/Entitlement.php Outdated Show resolved Hide resolved
src/Discord/Parts/Interactions/Entitlement.php Outdated Show resolved Hide resolved
src/Discord/Parts/Interactions/Entitlement.php Outdated Show resolved Hide resolved
src/Discord/Parts/Interactions/Entitlement.php Outdated Show resolved Hide resolved
src/Discord/WebSockets/Events/EntitlementCreate.php Outdated Show resolved Hide resolved
src/Discord/WebSockets/Events/EntitlementDelete.php Outdated Show resolved Hide resolved
src/Discord/WebSockets/Events/EntitlementUpdate.php Outdated Show resolved Hide resolved
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));
Copy link
Member

@SQKo SQKo Oct 22, 2023

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?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/Discord/WebSockets/Events/InteractionCreate.php Outdated Show resolved Hide resolved
@key2peace key2peace added the wait for discord Waiting for release by discord label Oct 26, 2023
Copy link
Member

@SQKo SQKo left a 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?

Comment on lines 1596 to 1602
* @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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Comment on lines 296 to 300
* @return Collection[]|Entitlement[]
*/
public function getMyApplicationEntitlement(): Collection
{
return $this->discord->application->entitlements->get('user_id', $this->id);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Copy link
Member

@SQKo SQKo left a 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)?

#943

* with this source code in the LICENSE.md file.
*/

namespace Discord\Parts\Interactions;
Copy link
Member

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;
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing async cache update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wait for discord Waiting for release by discord
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants