Browse Source

Note that emoji can be Null

pull/9260/head
Josh 2 years ago
parent
commit
d051807865
  1. 4
      discord/onboarding.py
  2. 2
      discord/types/emoji.py
  3. 4
      discord/types/onboarding.py

4
discord/onboarding.py

@ -63,7 +63,7 @@ class OnboardingPromptOption:
The title of this prompt option. The title of this prompt option.
description: Optional[:class:`str`] description: Optional[:class:`str`]
The description of this prompt option. The description of this prompt option.
emoji: Union[:class:`Emoji`, :class:`PartialEmoji`, :class:`str`] emoji: Optional[Union[:class:`Emoji`, :class:`PartialEmoji`, :class:`str`]]
The emoji tied to this option. May be a custom emoji, or a unicode emoji. The emoji tied to this option. May be a custom emoji, or a unicode emoji.
channel_ids: Set[:class:`int`] channel_ids: Set[:class:`int`]
The IDs of the channels that will be set visible if this option is selected. The IDs of the channels that will be set visible if this option is selected.
@ -90,7 +90,7 @@ class OnboardingPromptOption:
self.id: int = int(data['id']) self.id: int = int(data['id'])
self.title: str = data['title'] self.title: str = data['title']
self.description: Optional[str] = data['description'] self.description: Optional[str] = data['description']
self.emoji: Union[PartialEmoji, Emoji, str] = self._state.get_reaction_emoji(data['emoji']) self.emoji: Optional[Union[PartialEmoji, Emoji, str]] = self._state.get_reaction_emoji(data['emoji'])
self.channel_ids: Set[int] = {int(channel_id) for channel_id in data['channel_ids']} self.channel_ids: Set[int] = {int(channel_id) for channel_id in data['channel_ids']}
self.role_ids: Set[int] = {int(role_id) for role_id in data['role_ids']} self.role_ids: Set[int] = {int(role_id) for role_id in data['role_ids']}

2
discord/types/emoji.py

@ -23,6 +23,7 @@ DEALINGS IN THE SOFTWARE.
""" """
from typing import Optional, TypedDict from typing import Optional, TypedDict
from typing_extensions import NotRequired
from .snowflake import Snowflake, SnowflakeList from .snowflake import Snowflake, SnowflakeList
from .user import User from .user import User
@ -30,6 +31,7 @@ from .user import User
class PartialEmoji(TypedDict): class PartialEmoji(TypedDict):
id: Optional[Snowflake] id: Optional[Snowflake]
name: Optional[str] name: Optional[str]
animated: NotRequired[bool]
class Emoji(PartialEmoji, total=False): class Emoji(PartialEmoji, total=False):

4
discord/types/onboarding.py

@ -26,7 +26,7 @@ from __future__ import annotations
from typing import Literal, Optional, TypedDict from typing import Literal, Optional, TypedDict
from .emoji import Emoji from .emoji import PartialEmoji
from .snowflake import Snowflake from .snowflake import Snowflake
@ -37,7 +37,7 @@ class PromptOption(TypedDict):
id: Snowflake id: Snowflake
channel_ids: list[Snowflake] channel_ids: list[Snowflake]
role_ids: list[Snowflake] role_ids: list[Snowflake]
emoji: Emoji emoji: PartialEmoji
title: str title: str
description: Optional[str] description: Optional[str]

Loading…
Cancel
Save