Use more emojis for transcode status

This commit is contained in:
Nexus 2024-04-16 00:57:59 +01:00
parent ec317d196a
commit 10cb02d7f3
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -212,8 +212,11 @@ class AutoResponder(commands.Cog):
file, _p = _r file, _p = _r
if file: if file:
if _p.stat().st_size <= 24.5 * 1024 * 1024: if _p.stat().st_size <= 24.5 * 1024 * 1024:
await message.add_reaction("\N{OUTBOX TRAY}")
await message.reply(file=file) await message.reply(file=file)
await message.remove_reaction("\N{OUTBOX TRAY}", self.bot.user)
else: else:
await message.add_reaction("\N{OUTBOX TRAY}")
self.log.warning( self.log.warning(
"Transcoded file too large: %r (%.2f)MB", "Transcoded file too large: %r (%.2f)MB",
_p, _p,
@ -228,8 +231,15 @@ class AutoResponder(commands.Cog):
files={"file": (_p.name, file.fp, "video/mp4")}, files={"file": (_p.name, file.fp, "video/mp4")},
headers={"User-Agent": "CollegeBot (matrix: @nex:nexy7574.co.uk)"}, headers={"User-Agent": "CollegeBot (matrix: @nex:nexy7574.co.uk)"},
) )
await message.remove_reaction("\N{OUTBOX TRAY}", self.bot.user)
if response.status_code == 200: if response.status_code == 200:
await message.reply("https://embeds.video/" + response.text.strip()) await message.reply("https://embeds.video/" + response.text.strip())
else:
await message.add_reaction("\N{BUG}")
response.raise_for_status()
else:
await message.add_reaction("\N{HAMBURGER}")
_p.unlink() _p.unlink()
except Exception as e: except Exception as e:
self.log.error("Failed to transcode %r: %r", link, e) self.log.error("Failed to transcode %r: %r", link, e)