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

Add Guild.acronym #10080

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

Add Guild.acronym #10080

wants to merge 2 commits into from

Conversation

Soheab
Copy link
Contributor

@Soheab Soheab commented Jan 17, 2025

Summary

This PR adds an acronym property to Guild that returns the characters that show up when a server has no icon set.

The property returns a cached version (_acronym) since it rarely, if ever, changes.

I got this idea from the discord.js library. I have converted it to Python as is.

Discussion post: https://canary.discord.com/channels/336642139381301249/1279035934192439388

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • 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, ...)

@Rapptz
Copy link
Owner

Rapptz commented Jan 19, 2025

I have two main issues with this.

  1. The current implementation wastes memory for those who do not care about this feature (i.e. most people)
  2. The current implementation feels dodgy. It's using regex for no good reason and expensively so, it seems like it's a 1:1 port of JS code without porting it to the target language's strength.

Other than that I'm not sure on the overall merit of the PR. Is this a commonly requested feature? If you do a simple search of nameAcronym on GitHub you don't get that many results of people actually using it.

@Soheab
Copy link
Contributor Author

Soheab commented Jan 24, 2025

I have two main issues with this.

  1. The current implementation wastes memory for those who do not care about this feature (i.e. most people)
  2. The current implementation feels dodgy. It's using regex for no good reason and expensively so, it seems like it's a 1:1 port of JS code without porting it to the target language's strength.

Other than that I'm not sure on the overall merit of the PR. Is this a commonly requested feature? If you do a simple search of nameAcronym on GitHub you don't get that many results of people actually using it.

1 & 2. Fair points. Unfortunately, I don't know how to fix that, as I am very new to regex usage. Reviews are welcome.

This is not a requested feature, but I thought it would fit in between the other features, as others pointed out, like Message.system_content, Member.top_role, etc.

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

Successfully merging this pull request may close these issues.

2 participants