From 0b612516017b2e76cd38e4a3a89dec3b5bbad7c2 Mon Sep 17 00:00:00 2001 From: Swee Date: Sat, 12 Oct 2024 15:21:22 -0700 Subject: [PATCH] Update sweebot.py --- sweebot.py | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/sweebot.py b/sweebot.py index 42293ef..135f3b8 100644 --- a/sweebot.py +++ b/sweebot.py @@ -566,24 +566,23 @@ while True: elif ":3c" in command: if not sbconfig.cflagexist(channel, "-colonthree"): multiline(choice(threes), channel) - else: - # try to parse and find a link - if sbconfig.cflagexist(channel, "+links"): - for i in command: - if i[:7] == "https://": - e = get(i) - if e.ok: - soup = BeautifulSoup(e.text, 'html.parser') - multiline("(" + nick + ") " + soup.title.string if soup.title.string != None else "[No title provided]", channel) - else: - multiline("(" + nick + ") HTTP " + str(e.status_code), channel) - elif i[:6] == "http://": - e = get(i) - if e.ok: - soup = BeautifulSoup(e.text, 'html.parser') - multiline("(" + nick + ") " + soup.title.string if soup.title.string != None else "[No title provided]", channel) - else: - multiline("(" + nick + ") HTTP " + str(e.status_code), channel) + # try to parse and find a link + if sbconfig.cflagexist(channel, "+links"): + for i in command: + if i[:8] == "https://": + e = get(i) + if e.ok: + soup = BeautifulSoup(e.text, 'html.parser') + multiline("(" + nick + ") " + soup.title.string if soup.title.string != None else "[No title provided]", channel) + else: + multiline("(" + nick + ") HTTP " + str(e.status_code), channel) + elif i[:7] == "http://": + e = get(i) + if e.ok: + soup = BeautifulSoup(e.text, 'html.parser') + multiline("(" + nick + ") " + soup.title.string if soup.title.string != None else "[No title provided]", channel) + else: + multiline("(" + nick + ") HTTP " + str(e.status_code), channel) elif "JOIN" in text and "#nixsanctuary" in text: nick = text.split(":")[1].split("!")[0] if not "swee" in nick: