Skip to content

Commit

Permalink
Fix color format in YoutubeChatRecord.discord_embed
Browse files Browse the repository at this point in the history
  • Loading branch information
user committed Feb 12, 2024
1 parent 9d7be54 commit 1df7032
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions avtdl/plugins/youtube/youtube_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class YoutubeChatRecord(Record):
message_header: Optional[str] = None
sticker: Optional[str] = None
"""supersticker name if the message is a supersticker, otherwise empty"""
color: Optional[str] = None
"""message header color, if present"""
color: Optional[int] = None
"""message header color (RGB integer), if present"""

uid: str
"""unique id of the message"""
Expand Down Expand Up @@ -290,11 +290,11 @@ def runs_to_text(runs: dict) -> str:
return message

@classmethod
def parse_color(cls, color: int) -> Optional[str]:
"""Take color as 0xAARRGGBB and return it as #RRGGBB"""
def parse_color(cls, color: int) -> Optional[int]:
"""Take color as 0xAARRGGBB and return it as 0xRRGGBB"""
if not isinstance(color, int):
return None
return f'#{color & 0xFFFFFF:06x}'
return color & 0xFFFFFF

def parse_chat_renderer(self, action_type: str, renderer_type: str, renderer: dict) -> YoutubeChatRecord:
uid = renderer.get('id')
Expand Down

0 comments on commit 1df7032

Please sign in to comment.