disable seafile image preview
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Roy Olav Purser 2024-05-25 20:08:06 +02:00
parent 47340dfdb4
commit a545af54cf
Signed by: roypur
GPG Key ID: 063DAA01D56E28CB

11
bot.py
View File

@ -56,12 +56,13 @@ class CustomClient(discord.Client):
f"https://stream.purser.it/{stripped}/?provider=seafile&raw=true",
allow_redirects=True,
)
raw = str(
(ctype := resp.headers.get("content-type")) and "image" in ctype
).lower()
if (ctype := resp.headers.get("content-type")) and "image" in ctype:
await message.reply(
content=f"https://stream.purser.it/{stripped}/?provider=seafile&raw={raw}"
content=f"<https://stream.purser.it/{stripped}/?provider=seafile&raw=true>"
)
else:
await message.reply(
content=f"https://stream.purser.it/{stripped}/?provider=seafile&raw=false"
)
elif "twitch" in url.hostname: