Skip to content

Commit 36b6bb1

Browse files
Preserve Invocation Context
1 parent cb4401b commit 36b6bb1

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

bot/exts/utils/snekbox/_cog.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,18 @@ async def send_job(self, ctx: Context, job: EvalJob) -> Message:
450450
)
451451
else:
452452
# The command was redirected so a reply wont work, send a normal message with a mention.
453-
msg = f"{ctx.author.mention} {msg}"
453+
try:
454+
paste_response = await send_to_paste_service(
455+
files=[PasteFile(content=ctx.message.content, lexer="markdown")],
456+
http_session=self.bot.http_session,
457+
paste_url=BaseURLs.paste_url,
458+
)
459+
paste_link = paste_response.link
460+
msg = f"Here's the output of your command\n{paste_link}:\n{msg}"
461+
except paste_service.PasteUploadError:
462+
# Fallback if paste service fails
463+
msg = f"{ctx.author.mention} {msg}"
464+
log.warning("Pastebin Upload Error")
454465
response = await ctx.send(msg, allowed_mentions=allowed_mentions, view=view, files=files)
455466
view.message = response
456467

0 commit comments

Comments
 (0)