From 6a9d92e03d19ec2a774451c609d2515580f42b6b Mon Sep 17 00:00:00 2001 From: swee Date: Thu, 16 Jan 2025 20:12:52 -0800 Subject: [PATCH] Update sweebot.py --- sweebot.py | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/sweebot.py b/sweebot.py index ac01600..648c80d 100644 --- a/sweebot.py +++ b/sweebot.py @@ -870,28 +870,31 @@ while True: title = False redirected = False for i in received.split("\n"): - if firstline: - if i.split(" ")[0][0] == "3": - redirected = True - parsed = urlparse(i.split(" ")[1]) - unparsed = i.split(" ")[1] - break - elif i.split(" ")[0][0] != "2": - title = True - multiline("(" + nick + f") [{i}]", channel) - break + try: + if firstline: + if i.split(" ")[0][0] == "3": + redirected = True + parsed = urlparse(i.split(" ")[1]) + unparsed = i.split(" ")[1] + break + elif i.split(" ")[0][0] != "2": + title = True + multiline("(" + nick + f") [{i}]", channel) + break + else: + firstline = False + if i.split(" ")[1] != "text/gemini": + typee = i.split(" ")[1] + multiline("(" + nick + f") [Non-Gemtext file: {typee}]", channel) + title = True + break else: - firstline = False - if i.split(" ")[1] != "text/gemini": - typee = i.split(" ")[1] - multiline("(" + nick + f") [Non-Gemtext file: {typee}]", channel) - title = True - break - else: - if i.split(" ")[0][0] == "#" and not i.split(" ")[0][1] == "#": - title = True - multiline("(" + nick + f") " + i[2:], channel) - break + if i.split(" ")[0][0] == "#" and not i.split(" ")[0][1] == "#": + title = True + multiline("(" + nick + f") " + i[2:], channel) + break + except: + pass if not title and not redirected: multiline("(" + nick + ") [No title found]", channel) if not redirected: