mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-13 17:29:50 +00:00
Fix typing errors in PartialEmoji
This commit is contained in:
parent
8b4dd34328
commit
93cc1bdd79
@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Dict, Optional, TYPE_CHECKING, Type, TypeVar
|
from typing import Any, Dict, Optional, TYPE_CHECKING, Type, TypeVar, Union
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .asset import Asset, AssetMixin
|
from .asset import Asset, AssetMixin
|
||||||
@ -104,11 +104,11 @@ class PartialEmoji(_EmojiTag, AssetMixin):
|
|||||||
self._state: Optional[ConnectionState] = None
|
self._state: Optional[ConnectionState] = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_dict(cls: Type[PE], data: Dict[str, Any]) -> PE:
|
def from_dict(cls: Type[PE], data: Union[PartialEmojiPayload, Dict[str, Any]]) -> PE:
|
||||||
return cls(
|
return cls(
|
||||||
animated=data.get('animated', False),
|
animated=data.get('animated', False),
|
||||||
id=utils._get_as_snowflake(data, 'id'),
|
id=utils._get_as_snowflake(data, 'id'),
|
||||||
name=data.get('name', ''),
|
name=data.get('name') or '',
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
x
Reference in New Issue
Block a user