Skip to content

Add Guild.acronym #10080

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add Guild.acronym
  • Loading branch information
Soheab committed Jan 17, 2025
commit bb7c056b455ca64ba7296c849fba3abe12d4cd11
12 changes: 12 additions & 0 deletions discord/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
overload,
)
import warnings
import re

from . import utils, abc
from .role import Role
Expand Down Expand Up @@ -447,6 +448,7 @@ class Guild(Hashable):
'max_stage_video_users',
'_incidents_data',
'_soundboard_sounds',
'_acronym',
)

_PREMIUM_GUILD_LIMITS: ClassVar[Dict[Optional[int], _GuildLimit]] = {
Expand Down Expand Up @@ -578,6 +580,8 @@ def _from_data(self, guild: GuildPayload) -> None:
pass

self.name: str = guild.get('name', '')
self._acronym = re.sub(r"\s", "", re.sub(r"\w+", lambda e: e.group(0)[0], re.sub(r"'s ", " ", self.name)))

self.verification_level: VerificationLevel = try_enum(VerificationLevel, guild.get('verification_level'))
self.default_notifications: NotificationLevel = try_enum(
NotificationLevel, guild.get('default_message_notifications')
Expand Down Expand Up @@ -4787,3 +4791,11 @@ async def create_soundboard_sound(

data = await self._state.http.create_soundboard_sound(self.id, reason=reason, **payload)
return SoundboardSound(guild=self, state=self._state, data=data)

@property
def acronym(self) -> str:
""":class:`str`: Returns the acronym that shows up in place of a guild icon

.. versionadded:: 2.5
"""
return self._acronym
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy