From 357dc5db4d1761a3a4cd89236d1ecc744bc9b403 Mon Sep 17 00:00:00 2001 From: acidvegas Date: Mon, 26 Jun 2023 03:45:25 -0400 Subject: [PATCH] Check line legnth on .ascii img to prevent large image conversions outside of #scroll --- scroll.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scroll.py b/scroll.py index 5b5780e..d8c4a12 100644 --- a/scroll.py +++ b/scroll.py @@ -249,9 +249,12 @@ class Bot(): await self.irc_error(chan, 'failed to convert image', ex) else: if ascii: - for line in ascii: - await self.sendmsg(chan, line) - await asyncio.sleep(self.settings['msg']) + if len(ascii) <= self.settings['lines']: + for line in ascii: + await self.sendmsg(chan, line) + await asyncio.sleep(self.settings['msg']) + else: + await self.irc_error('image is too big', 'take it to #scroll') elif msg == '.ascii list': await self.sendmsg(chan, underline + color('https://raw.githubusercontent.com/ircart/ircart/master/ircart/.list', light_blue)) elif msg == '.ascii random':