From 5d7e5dd63d3cee409237966f64d3dbf51f0d443d Mon Sep 17 00:00:00 2001 From: Gordon Shumway <39967334+oddluck@users.noreply.github.com> Date: Mon, 15 Apr 2019 07:02:00 -0400 Subject: [PATCH] check not html before ansi2irc conversion --- ASCII/plugin.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ASCII/plugin.py b/ASCII/plugin.py index c88eef4..a081fab 100644 --- a/ASCII/plugin.py +++ b/ASCII/plugin.py @@ -436,7 +436,7 @@ class ASCII(callbacks.Plugin): os.remove(filename) except: pass - irc.reply("Please be patient while I render the image into ASCII characters and colorize the output.") + irc.reply("Please be patient while I render the image into ANSI shader blocks and colorize the output.") # store dimensions W, H = image.size[0], image.size[1] # compute width of tile @@ -518,8 +518,9 @@ class ASCII(callbacks.Plugin): if url.startswith("https://paste.ee/p/"): url = re.sub("https://paste.ee/p/", "https://paste.ee/r/", url) file = requests.get(url) - if "html" in file.text: - irc.reply("Error: Scroll requires a text file as input.") + if "" in file.text: + irc.reply("Error: ansi2irc requires a text file as input.") + return elif url.endswith(".txt") or url.startswith("https://pastebin.com/raw/") or url.startswith("https://paste.ee/r/"): for line in file.text.splitlines(): if line.strip(): @@ -533,6 +534,10 @@ class ASCII(callbacks.Plugin): Convert ANSI files to IRC formatted text """ if url.lower().endswith(".ans"): + file = requests.get(url) + if "" in file.text: + irc.reply("Error: ansi2irc requires a text file as input.") + return try: path = os.path.dirname(os.path.abspath(__file__)) filepath = "{0}/tmp".format(path)