Browse Source

Fix passing None to ForumTag.emoji constructor

pull/8476/head
Vioshim 3 years ago
committed by GitHub
parent
commit
46d194df57
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      discord/channel.py

6
discord/channel.py

@ -2006,7 +2006,7 @@ class ForumTag(Hashable):
__slots__ = ('name', 'id', 'moderated', 'emoji')
def __init__(self, *, name: str, emoji: Optional[EmojiInputType], moderated: bool = False) -> None:
def __init__(self, *, name: str, emoji: Optional[EmojiInputType] = None, moderated: bool = False) -> None:
self.name: str = name
self.id: int = 0
self.moderated: bool = moderated
@ -2015,8 +2015,8 @@ class ForumTag(Hashable):
self.emoji = emoji._to_partial()
elif isinstance(emoji, str):
self.emoji = PartialEmoji.from_str(emoji)
else:
raise TypeError(f'emoji must be a Emoji, PartialEmoji, or str not {emoji.__class__.__name__}')
elif emoji is not None:
raise TypeError(f'emoji must be a Emoji, PartialEmoji, str or None not {emoji.__class__.__name__}')
@classmethod
def from_data(cls, *, state: ConnectionState, data: ForumTagPayload) -> Self:

Loading…
Cancel
Save