Skip to content

Patreon #1917

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

Merged
merged 41 commits into from
Oct 5, 2022
Merged

Patreon #1917

merged 41 commits into from
Oct 5, 2022

Conversation

mathstrains21
Copy link
Contributor

Closes #1765

First off, this is my first pull request so please give me general pull request feedback if you have any :-)

Some decisions have been made on discord. A search of bot#1765 should find you all the conversations.

Some changes to make to test:

  • Create 3 new roles, with clear different colours so you can see colours on embeds!
  • Put these in your config.yml

There are 2 new commands: !patrons and !patreon. These send the list of patrons and some patreon info respectively.

Logging

I have not included an logging. Please provide feedback about logging.

@mathstrains21
Copy link
Contributor Author

I would also like a review from @ChrisLovering - cannot work out how to request a review from you though :-)

Copy link
Contributor

@TizzySaurus TizzySaurus left a comment

Choose a reason for hiding this comment

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

Thanks for the hardwork you've put into this PR!

A few small things in my preliminary review.

@wookie184 wookie184 marked this pull request as ready for review September 10, 2022 17:40
@wookie184 wookie184 dismissed stale reviews from TizzySaurus and themself September 10, 2022 17:43

Changes made

@wookie184 wookie184 requested review from ionite34, Bluenix2, minalike and onerandomusername and removed request for Akarys42 September 10, 2022 17:44
@onerandomusername
Copy link
Contributor

Please remove my request for review.

@wookie184 wookie184 removed the request for review from onerandomusername September 10, 2022 17:50
@wookie184 wookie184 added s: needs review Author is waiting for someone to review and approve and removed s: waiting for author Waiting for author to address a review or respond to a comment labels Sep 10, 2022
Copy link
Contributor

@onerandomusername onerandomusername left a comment

Choose a reason for hiding this comment

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

didn't intend to leave another review but I am.

Comment on lines +54 to +58
@commands.Cog.listener()
async def on_member_update(self, before: discord.Member, after: discord.Member) -> None:
"""Send a message when someone receives a patreon role."""
old_patreon_tier = get_patreon_tier(before)
new_patreon_tier = get_patreon_tier(after)
Copy link
Contributor

Choose a reason for hiding this comment

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

This has an inherent dependency on how the patreon bot works. If the patreon bot decided to take away and giveth the new role in two seperate api requests, this would cease to work. Or, if the patreon bot were to take the old role away and then give the new role, this would also cease to work.

This all hinges on the patreon bot making a single api request, and would lead to funky behaviour if their bot used more than one request--and I believe it does.

Copy link
Contributor

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 should be an issue. Whatever order things happen there will still only be one member_update that involves the tier increasing, which is all that this checks.

The only slightly unintended case would be if a user moves down a tier (e.g. from 3 to 2), and the bot does this by removing 3 and then adding 2. In this case the message would be sent, although it still wouldn't be incorrect (Just saying they are now a tier 2 patron).

Fixing this would probably require waiting for other role changes to see if they change things, although this could be fairly complicated so I think it would be best to see how what we have currently works out.

Copy link
Contributor

@TizzySaurus TizzySaurus left a comment

Choose a reason for hiding this comment

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

A few points, mostly about style so not requesting changes so as to not block the PR with this review.

@ionite34 ionite34 self-requested a review September 11, 2022 17:53
@wookie184 wookie184 dismissed ionite34’s stale review September 17, 2022 13:33

Suggestions applied

Copy link
Member

@ionite34 ionite34 left a comment

Choose a reason for hiding this comment

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

Wasn't able to test the role assignments on real users, but seem to work fine in manual testing.

Copy link
Member

@ChrisLovering ChrisLovering left a comment

Choose a reason for hiding this comment

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

Approving as my only comment won't affect us atm, so I'll leave it to you to decide whether to action it before merging.

I've also taken the liberty of adding the 3 patreon roles to the test server and updating the config.yml in notion.

@wookie184
Copy link
Contributor

I've also taken the liberty of adding the 3 patreon roles to the test server and updating the config.yml in notion.

Thanks, I definitely did not forget those were things that would need to be done :P

@wookie184 wookie184 merged commit 5ab04a8 into python-discord:main Oct 5, 2022
@mathstrains21 mathstrains21 deleted the patreon branch October 6, 2022 18:07
@mathstrains21
Copy link
Contributor Author

Thanks @wookie184 for finishing this off for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: backend Related to internal functionality and utilities (error_handler, logging, security, utils and core) a: information Related to information commands: (doc, help, information, reddit, site, tags) p: 2 - normal Normal Priority s: needs review Author is waiting for someone to review and approve t: feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shoutout our patreon supporters!
9 participants