Add Protocol Urls (#103)
Co-authored-by: Stocker <44980366+StockerMC@users.noreply.github.com> Co-authored-by: Gnome! <45660393+Gnome-py@users.noreply.github.com>
This commit is contained in:
@ -55,6 +55,7 @@ __all__ = (
|
||||
"InteractionType",
|
||||
"InteractionResponseType",
|
||||
"NSFWLevel",
|
||||
"ProtocolURL",
|
||||
)
|
||||
|
||||
|
||||
@ -592,6 +593,74 @@ class NSFWLevel(Enum, comparable=True):
|
||||
age_restricted = 3
|
||||
|
||||
|
||||
class ProtocolURL(Enum):
|
||||
|
||||
# General
|
||||
|
||||
home = "discord://-/channels/@me/"
|
||||
nitro = "discord://-/store"
|
||||
apps = "discord://-/apps" # Breaks the client on windows (Shows download links for different OS)
|
||||
guild_discovery = "discord://-/guild-discovery"
|
||||
guild_create = "discord://-/guilds/create"
|
||||
guild_invite = "discord://-/invite/{invite_code}"
|
||||
|
||||
# Settings
|
||||
|
||||
account_settings = "discord://-/settings/account"
|
||||
profile_settings = "discord://-/settings/profile-customization"
|
||||
privacy_settings = "discord://-/settings/privacy-and-safety"
|
||||
safety_settings = "discord://-/settings/privacy-and-safety" # Alias
|
||||
authorized_apps_settings = "discord://-/settings/authorized-apps"
|
||||
connections_settings = "discord://-/settings/connections"
|
||||
nitro_settings = "discord://-/settings/premium" # Same as store, but inside of settings
|
||||
guild_premium_subscription = "discord://-/settings/premium-guild-subscription"
|
||||
subscription_settings = "discord://-/settings/subscriptions"
|
||||
gift_inventory_settings = "discord://-/settings/inventory"
|
||||
billing_settings = "discord://-/settings/billing"
|
||||
appearance_settings = "discord://-/settings/appearance"
|
||||
accessibility_settings = "discord://-/settings/accessibility"
|
||||
voice_video_settings = "discord://-/settings/voice"
|
||||
text_images_settings = "discord://-/settings/text"
|
||||
notifications_settings = "discord://-/settings/notifications"
|
||||
keybinds_settings = "discord://-/settings/keybinds"
|
||||
language_settings = "discord://-/settings/locale"
|
||||
windows_settings = "discord://-/settings/windows" # Doesnt work if used on wrong platform
|
||||
linux_settings = "discord://-/settings/linux" # Doesnt work if used on wrong platform
|
||||
streamer_mode_settings = "discord://-/settings/streamer-mode"
|
||||
advanced_settings = "discord://-/settings/advanced"
|
||||
activity_status_settings = "discord://-/settings/activity-status"
|
||||
game_overlay_settings = "discord://-/settings/overlay"
|
||||
hypesquad_settings = "discord://-/settings/hypesquad-online"
|
||||
|
||||
changelogs = "discord://-/settings/changelogs"
|
||||
|
||||
# Doesn't work if you don't have it actually activated. Just blank screen.
|
||||
experiments = "discord://-/settings/experiments"
|
||||
|
||||
developer_options = "discord://-/settings/developer-options" # Same as experiments
|
||||
hotspot_options = "discord://-/settings/hotspot-options" # Same as experiments
|
||||
|
||||
# Users, Guilds, and DMs
|
||||
|
||||
user_profile = "discord://-/users/{user_id}"
|
||||
dm_channel = "discord://-/channels/@me/{channel_id}"
|
||||
dm_message = "discord://-/channels/@me/{channel_id}/{message_id}"
|
||||
guild_channel = "discord://-/channels/{guild_id}/{channel_id}"
|
||||
guild_message = "discord://-/channels/{guild_id}/{channel_id}/{message_id}"
|
||||
guild_membership_screening = "discord://-/member-verification/{guild_id}"
|
||||
|
||||
# Library
|
||||
|
||||
games_library = "discord://-/library"
|
||||
library_settings = "discord://-/library/settings"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.value
|
||||
|
||||
def format(self, **kwargs: Any) -> str:
|
||||
return self.value.format(**kwargs)
|
||||
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
|
@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Callable, Optional, TYPE_CHECKING, Tuple, Type, TypeVar, Union
|
||||
from typing import Any, Callable, Optional, TYPE_CHECKING, Tuple, Type, TypeVar, Union
|
||||
import inspect
|
||||
import os
|
||||
|
||||
@ -60,7 +60,7 @@ class Button(Item[V]):
|
||||
The ID of the button that gets received during an interaction.
|
||||
If this button is for a URL, it does not have a custom ID.
|
||||
url: Optional[:class:`str`]
|
||||
The URL this button sends you to.
|
||||
The URL this button sends you to. This param is automatically casted to :class:`str`.
|
||||
disabled: :class:`bool`
|
||||
Whether the button is disabled or not.
|
||||
label: Optional[:class:`str`]
|
||||
@ -91,7 +91,7 @@ class Button(Item[V]):
|
||||
label: Optional[str] = None,
|
||||
disabled: bool = False,
|
||||
custom_id: Optional[str] = None,
|
||||
url: Optional[str] = None,
|
||||
url: Optional[Any] = None,
|
||||
emoji: Optional[Union[str, Emoji, PartialEmoji]] = None,
|
||||
row: Optional[int] = None,
|
||||
):
|
||||
@ -117,7 +117,7 @@ class Button(Item[V]):
|
||||
self._underlying = ButtonComponent._raw_construct(
|
||||
type=ComponentType.button,
|
||||
custom_id=custom_id,
|
||||
url=url,
|
||||
url=str(url) if url else None,
|
||||
disabled=disabled,
|
||||
label=label,
|
||||
style=style,
|
||||
|
Reference in New Issue
Block a user