Skip to content

Commit

Permalink
Sponsored Memberships renderers edited
Browse files Browse the repository at this point in the history
  • Loading branch information
KaitoCross committed Sep 13, 2024
1 parent 46d2d42 commit d1f35b8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pytchat/processors/default/renderer/sponsorshipsgiftpurchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,19 @@ def get_authordetails(self):
)
self.chat.author.channelId = self.item.get("authorExternalChannelId")
self.chat.author.channelUrl = "http://www.youtube.com/channel/" + self.chat.author.channelId
self.chat.author.name = self.item["header"]["liveChatSponsorshipsHeaderRenderer"]["authorName"]["simpleText"]
self.chat.author.imageUrl = self.item["header"]["liveChatSponsorshipsHeaderRenderer"]["authorPhoto"]["thumbnails"][1]["url"]
header = self.item["header"]["liveChatSponsorshipsHeaderRenderer"]
self.chat.author.name = header["authorName"]["simpleText"]
self.chat.author.imageUrl = header["authorPhoto"]["thumbnails"][1]["url"]
self.chat.author.isChatSponsor = True
dummy = [None, {"text": "0"}, None, None, None]
if "primaryText" in header.keys():
runs = header.get("primaryText", {}).get("runs", dummy)
else:
runs = dummy
if len(runs) == 5:
self.chat.amountString = runs[1]["text"]
self.chat.amountValue = float(self.chat.amountString)
self.chat.currency = "MGI"

def get_message(self, item):
message = ''.join([mes.get("text", "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
class LiveChatSponsorshipsGiftRedemptionAnnouncementRenderer(BaseRenderer):
def settype(self):
self.chat.type = "giftRedemption"
self.chat.member_level = "<GIFTED>"

def get_message(self, item):
message = ''.join([mes.get("text", "")
Expand Down

0 comments on commit d1f35b8

Please sign in to comment.