def resolve_invite(invite: Union[(Invite, str)]) -> str:
    '\n    Resolves an invite from a :class:`~discord.Invite`, URL or code.\n\n    Parameters\n    -----------\n    invite: Union[:class:`~discord.Invite`, :class:`str`]\n        The invite.\n\n    Returns\n    --------\n    :class:`str`\n        The invite code.\n    '
    from .invite import Invite
    if isinstance(invite, Invite):
        return invite.code
    else:
        rx = '(?:https?\\:\\/\\/)?discord(?:\\.gg|(?:app)?\\.com\\/invite)\\/(.+)'
        m = re.match(rx, invite)
        if m:
            return m.group(1)
    return invite
Resolves an invite from a :class:`~discord.Invite`, URL or code.

Parameters
-----------
invite: Union[:class:`~discord.Invite`, :class:`str`]
    The invite.

Returns
--------
:class:`str`
    The invite code.
def resolve_invite(invite: Union[(Invite, str)]) -> str:
    '\n    Resolves an invite from a :class:`~discord.Invite`, URL or code.\n\n    Parameters\n    -----------\n    invite: Union[:class:`~discord.Invite`, :class:`str`]\n        The invite.\n\n    Returns\n    --------\n    :class:`str`\n        The invite code.\n    '
    from .invite import Invite
    if isinstance(invite, Invite):
        return invite.code
    else:
        rx = '(?:https?\\:\\/\\/)?discord(?:\\.gg|(?:app)?\\.com\\/invite)\\/(.+)'
        m = re.match(rx, invite)
        if m:
            return m.group(1)
    return invite