diff options
Diffstat (limited to 'bot/exts/moderation/dm_relay.py')
-rw-r--r-- | bot/exts/moderation/dm_relay.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/bot/exts/moderation/dm_relay.py b/bot/exts/moderation/dm_relay.py index a86c9e409..bf0b96a58 100644 --- a/bot/exts/moderation/dm_relay.py +++ b/bot/exts/moderation/dm_relay.py @@ -5,7 +5,7 @@ from bot.bot import Bot from bot.constants import Emojis, MODERATION_ROLES from bot.log import get_logger from bot.utils.channel import is_mod_channel -from bot.utils.services import send_to_paste_service +from bot.utils.services import PasteTooLongError, PasteUploadError, send_to_paste_service log = get_logger(__name__) @@ -53,14 +53,14 @@ class DMRelay(Cog): f"User: {user} ({user.id})\n" f"Channel ID: {user.dm_channel.id}\n\n" ) - - paste_link = await send_to_paste_service(metadata + output, extension="txt") - - if paste_link is None: - await ctx.send(f"{Emojis.cross_mark} Failed to upload output to hastebin.") - return - - await ctx.send(paste_link) + try: + message = await send_to_paste_service(metadata + output, extension="txt") + except PasteTooLongError: + message = f"{Emojis.cross_mark} Too long to upload to paste service." + except PasteUploadError: + message = f"{Emojis.cross_mark} Failed to upload to paste service." + + await ctx.send(message) async def cog_check(self, ctx: Context) -> bool: """Only allow moderators to invoke the commands in this cog in mod channels.""" |