Skip to content

fix: remove internal use of deprecated role type methods#3167

Open
Revnoplex wants to merge 5 commits intoPycord-Development:masterfrom
Revnoplex:fix/internal-deprecated-method-use
Open

fix: remove internal use of deprecated role type methods#3167
Revnoplex wants to merge 5 commits intoPycord-Development:masterfrom
Revnoplex:fix/internal-deprecated-method-use

Conversation

@Revnoplex
Copy link
Contributor

@Revnoplex Revnoplex commented Mar 22, 2026

Caution

Feature freeze is active, as described by our Release Schedule.

Summary

#2708 deprecated the use of certain role type methods (eg. Role.is_premium_subscriber) in favour of the RoleType enum. Now I found the library throwing several deprecation warnings when firing the on_guild_update event and upon tracing the lines the warnings were emitted from found several uses of the old methods. This pr replaces the found internal usage of these old methods.

Information

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.
  • AI Usage has been disclosed.
    • If AI has been used, I understand fully what the code does

@Revnoplex Revnoplex requested review from a team, Icebluewolf and NeloBlivion March 22, 2026 21:58
@Revnoplex Revnoplex requested a review from JustaSqu1d March 22, 2026 21:58
@Revnoplex Revnoplex requested a review from a team as a code owner March 22, 2026 21:58
@github-project-automation github-project-automation bot moved this to Todo in Pycord Mar 22, 2026
@Revnoplex Revnoplex requested review from Lulalaby and removed request for a team March 22, 2026 21:58
@pycord-app
Copy link

pycord-app bot commented Mar 22, 2026

Thanks for opening this pull request!
Please make sure you have read the Contributing Guidelines and Code of Conduct.

This pull request can be checked-out with:

git fetch origin pull/3167/head:pr-3167
git checkout pr-3167

This pull request can be installed with:

pip install git+https://github.com/Pycord-Development/pycord@refs/pull/3167/head

@Revnoplex Revnoplex requested a review from a team as a code owner March 22, 2026 21:59
@Paillat-dev Paillat-dev self-requested a review March 22, 2026 21:59
@Paillat-dev
Copy link
Member

My fault...

@Paillat-dev Paillat-dev added this to the v2.8.0 milestone Mar 22, 2026
@Revnoplex
Copy link
Contributor Author

Revnoplex commented Mar 22, 2026

I'm assuming I need a changelog entry this time as theres an entry for 2.8.0rc1 and the problem was introduced before this

@Soheab
Copy link
Contributor

Soheab commented Mar 22, 2026

Should use is when comparing enums.

Copy link
Member

@Paillat-dev Paillat-dev left a comment

Choose a reason for hiding this comment

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

Yes needs a changelog as well.

Also please hold till I take a better look

.. versionadded:: 1.6
"""
return self.tags is not None and self.tags.is_bot_managed()
Copy link
Member

Choose a reason for hiding this comment

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

This one and the next 4 can use self.type instead of self.tags.type. Removes the need for an is not None check too.

Or alternatively use self.tags.method.__wrapped__() which would ensure the actual deprecated tags method is called to have truly the same code run as before deprecation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

how would I use self.tags.method.__wrapped__()?

Copy link
Member

Choose a reason for hiding this comment

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

For example in this case it would be

        return self.tags is not None and self.tags.is_bot_managed.__wrapped__()        

But I am not sure we wanna do this. Waiting to see what the others think

Copy link
Contributor Author

@Revnoplex Revnoplex Mar 22, 2026

Choose a reason for hiding this comment

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

I mean return self.type is RoleType.TYPE does look cleaner

Copy link
Member

Choose a reason for hiding this comment

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

The point is that if for some reason self.type is broken / incorrect, the "old deprecated" implementation would not break without notice. Extra safety.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I should wait for this to be reviewed

@Paillat-dev Paillat-dev added hold: changelog This pull request is missing a changelog entry hold: discussion This pull request needs to be further discussed between maintainers labels Mar 22, 2026
@Paillat-dev Paillat-dev added bug Something isn't working priority: medium Medium Priority labels Mar 22, 2026
@Revnoplex
Copy link
Contributor Author

wdym hold changelog, I added it. Unless I need to modify it or add another entry

@Paillat-dev Paillat-dev removed the hold: changelog This pull request is missing a changelog entry label Mar 22, 2026
@Paillat-dev
Copy link
Member

wdym hold changelog, I added it. Unless I need to modify it or add another entry

Didn't refresh on my end

@Paillat-dev Paillat-dev requested review from Soheab and plun1331 March 22, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working hold: discussion This pull request needs to be further discussed between maintainers priority: medium Medium Priority

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

4 participants