mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-07 11:48:55 -05:00
[Streams] Twitch: handle empty game / status / logo (#608)
This commit is contained in:
parent
b8b5572b07
commit
eb67e83d64
@ -369,12 +369,19 @@ class Streams:
|
||||
def twitch_embed(self, data):
|
||||
channel = data["stream"]["channel"]
|
||||
url = channel["url"]
|
||||
embed = discord.Embed(title=channel["status"], url=url)
|
||||
logo = channel["logo"]
|
||||
if logo is None:
|
||||
logo = "https://static-cdn.jtvnw.net/jtv_user_pictures/xarth/404_user_70x70.png"
|
||||
status = channel["status"]
|
||||
if not status:
|
||||
status = "Untitled broadcast"
|
||||
embed = discord.Embed(title=status, url=url)
|
||||
embed.set_author(name=channel["display_name"])
|
||||
embed.add_field(name="Followers", value=channel["followers"])
|
||||
embed.add_field(name="Total views", value=channel["views"])
|
||||
embed.set_thumbnail(url=channel["logo"])
|
||||
embed.set_thumbnail(url=logo)
|
||||
embed.set_image(url=data["stream"]["preview"]["medium"])
|
||||
if channel["game"]:
|
||||
embed.set_footer(text="Playing: " + channel["game"])
|
||||
embed.color = 0x6441A4
|
||||
return embed
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user