Repository: Rapptz/discord.py
File: discord/user.py (Python)

Code before:
    def mention(self) -> str:
        """:class:`str`: Returns a string that allows you to mention the given user."""
        return f'<@{self.id}>'

    @property
    def created_at(self) -> datetime:
        """:class:`datetime.datetime`: Returns the user's creation time in UTC.

        This is when the user's Discord account was created.
        """
        return snowflake_time(self.id)

    @property
    def display_name(self) -> str:
        """:class:`str`: Returns the user's display name.

        For regular users this is just their global name or their username,
        but if they have a guild specific nickname then that
        is returned instead.
        """
        if self.global_name:
            return self.global_name
        return self.name

    @property
    def primary_guild(self) -> Optional[PrimaryGuild]:
        """:class:`PrimaryGuild`: Returns the user's primary guild, if applicable."""
        if self._primary_guild:
            return PrimaryGuild(state=self._state, data=self._primary_guild)
        return None

    def mentioned_in(self, message: Message) -> bool:
        """Checks if the user is mentioned in the specified message.

        Parameters
        -----------
        message: :class:`Message`
            The message to check if you're mentioned in.

        Returns
        -------
        :class:`bool`
            Indicates if the user is mentioned in the message.
        """

        if message.mention_everyone:
            return True

        return any(user.id == self.id for user in message.mentions)



Review comment (suggestion):
For most users, this field will be present even if they don't have a `primary_guild` set (the `identity_enabled` value will just be false or null and there won't be an `identity_guild_id`). However, with some states, the field is null entirely. This is not a great API. Wondering if it's worth it to have a `PrimaryGuild._default()` so you don't have to null check for the `primary_guild` property.

Code after:
        """
        return self.colour

    @property
    def mention(self) -> str:
        """:class:`str`: Returns a string that allows you to mention the given user."""
        return f'<@{self.id}>'

    @property
    def created_at(self) -> datetime:
        """:class:`datetime.datetime`: Returns the user's creation time in UTC.

        This is when the user's Discord account was created.
        """
        return snowflake_time(self.id)

    @property
    def display_name(self) -> str:
        """:class:`str`: Returns the user's display name.

        For regular users this is just their global name or their username,
        but if they have a guild specific nickname then that
        is returned instead.
        """
        if self.global_name:
            return self.global_name
        return self.name

    @property
    def primary_guild(self) -> PrimaryGuild:
        """:class:`PrimaryGuild`: Returns the user's primary guild.

        .. versionadded:: 2.6"""
        if self._primary_guild is not None:
            return PrimaryGuild(state=self._state, data=self._primary_guild)
        return PrimaryGuild._default(self._state)

    def mentioned_in(self, message: Message) -> bool:
        """Checks if the user is mentioned in the specified message.

        Parameters
        -----------
        message: :class:`Message`
            The message to check if you're mentioned in.

        Returns
        -------
        :class:`bool`
            Indicates if the user is mentioned in the message.
        """