|
6 | 6 |
|
7 | 7 | import arrow |
8 | 8 | import discord |
9 | | -from aiohttp import ClientSession |
10 | 9 | from discord import Member, NotFound |
11 | 10 | from discord.ext import commands |
12 | 11 | from discord.ext.commands import Cog, Context |
@@ -159,17 +158,16 @@ async def inner(self: Cog, ctx: Context, *args, **kwargs) -> None: |
159 | 158 |
|
160 | 159 | paste_response = None |
161 | 160 | if RedirectOutput.delete_invocation: |
162 | | - async with ClientSession() as session: |
163 | | - try: |
164 | | - paste_response = await send_to_paste_service( |
165 | | - files=[PasteFile(content=ctx.message.content, lexer="markdown")], |
166 | | - http_session=session, |
167 | | - ) |
168 | | - except PasteUploadError: |
169 | | - log.exception( |
170 | | - "Failed to upload message %d in channel %d to paste service when redirecting output", |
171 | | - ctx.message.id, ctx.message.channel.id |
172 | | - ) |
| 161 | + try: |
| 162 | + paste_response = await send_to_paste_service( |
| 163 | + files=[PasteFile(content=ctx.message.content, lexer="markdown")], |
| 164 | + http_session=ctx.bot.http_session, |
| 165 | + ) |
| 166 | + except PasteUploadError: |
| 167 | + log.exception( |
| 168 | + "Failed to upload message %d in channel %d to paste service when redirecting output", |
| 169 | + ctx.message.id, ctx.message.channel.id |
| 170 | + ) |
173 | 171 |
|
174 | 172 | msg = "Here's the output of " |
175 | 173 | msg += f"[your command]({paste_response.link})" if paste_response else "your command" |
|
0 commit comments