|
5 | 5 | from contextlib import suppress |
6 | 6 |
|
7 | 7 | import arrow |
| 8 | +from aiohttp import ClientSession |
8 | 9 | from discord import Member, NotFound |
9 | 10 | from discord.ext import commands |
10 | 11 | from discord.ext.commands import Cog, Context |
11 | 12 | from pydis_core.utils import scheduling |
| 13 | +from pydis_core.utils.paste_service import PasteFile, send_to_paste_service |
12 | 14 |
|
13 | | -from bot.constants import Channels, DEBUG_MODE, RedirectOutput |
| 15 | +from bot.constants import BaseURLs, Channels, DEBUG_MODE, RedirectOutput |
14 | 16 | from bot.log import get_logger |
15 | 17 | from bot.utils import function |
16 | 18 | from bot.utils.checks import ContextCheckFailure, in_whitelist_check |
@@ -154,8 +156,19 @@ async def inner(self: Cog, ctx: Context, *args, **kwargs) -> None: |
154 | 156 | log.trace(f"Redirecting output of {ctx.author}'s command '{ctx.command.name}' to {redirect_channel.name}") |
155 | 157 | ctx.channel = redirect_channel |
156 | 158 |
|
| 159 | + paste_link = None |
| 160 | + async with ClientSession() as session: |
| 161 | + paste_response = await send_to_paste_service( |
| 162 | + files=[PasteFile(content=ctx.message.content, lexer="markdown")], |
| 163 | + http_session=session, |
| 164 | + paste_url=BaseURLs.paste_url, |
| 165 | + ) |
| 166 | + paste_link = paste_response.link |
| 167 | + |
157 | 168 | if ping_user: |
158 | | - await ctx.send(f"Here's the output of your command, {ctx.author.mention}") |
| 169 | + await ctx.send(f"Here's the output of [your command]({paste_link}), {ctx.author.mention}") |
| 170 | + else: |
| 171 | + await ctx.send(f"Here's the output of [your command]({paste_link})") |
159 | 172 | scheduling.create_task(func(self, ctx, *args, **kwargs)) |
160 | 173 |
|
161 | 174 | message = await old_channel.send( |
|
0 commit comments