Pycord-Development / pycord

Pycord is a modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python
https://docs.pycord.dev
MIT License
2.71k stars 459 forks source link

fix: premium buttons and entitlement iterator #2490

Closed tibue99 closed 2 months ago

tibue99 commented 2 months ago

Summary

This PR fixes some issues with monetization.

1) Premium buttons do not work with a custom ID, I disabled the auto-generated custom_id for premium buttons 2) bot.fetch_entitlements() did not work when certain parameters were not set 3) The exclude_ended attribute threw an error, because yarl does not support boolean params. I don't know how to fix that, so I just set it to None for now. Perhaps @plun1331 can help

I have tested the changes with a monetized Discord bot.

Edit: This PR now renames client.fetch_entitlements to client.entitlements.

Information

Checklist

plun1331 commented 2 months ago

The exclude_ended attribute threw an error, because yarl does not support boolean params. I don't know how to fix that, so I just set it to None for now. Perhaps @plun1331 can help

Casting it to a string in the http method should be good enough

Edit: other methods have cast it to int

Lulalaby commented 2 months ago

Timo for the win. Thank you

Dorukyum commented 2 months ago

Have the latest changes been tested?

tibue99 commented 2 months ago

Have the latest changes been tested?

I have tested client.entitlements() in production, but I have not tested the user/guild methods separately.