Update sweebot.py

This commit is contained in:
Swee 2024-10-12 15:24:05 -07:00
parent 0b61251601
commit 8f567cca09

View file

@ -568,21 +568,24 @@ while True:
multiline(choice(threes), channel) multiline(choice(threes), channel)
# try to parse and find a link # try to parse and find a link
if sbconfig.cflagexist(channel, "+links"): if sbconfig.cflagexist(channel, "+links"):
for i in command: try:
if i[:8] == "https://": for i in command:
e = get(i) if i[:8] == "https://":
if e.ok: e = get(i)
soup = BeautifulSoup(e.text, 'html.parser') if e.ok:
multiline("(" + nick + ") " + soup.title.string if soup.title.string != None else "[No title provided]", channel) soup = BeautifulSoup(e.text, 'html.parser')
else: multiline("(" + nick + ") " + soup.title.string if soup.title.string != None else "[No title provided]", channel)
multiline("(" + nick + ") HTTP " + str(e.status_code), channel) else:
elif i[:7] == "http://": multiline("(" + nick + ") HTTP " + str(e.status_code), channel)
e = get(i) elif i[:7] == "http://":
if e.ok: e = get(i)
soup = BeautifulSoup(e.text, 'html.parser') if e.ok:
multiline("(" + nick + ") " + soup.title.string if soup.title.string != None else "[No title provided]", channel) soup = BeautifulSoup(e.text, 'html.parser')
else: multiline("(" + nick + ") " + soup.title.string if soup.title.string != None else "[No title provided]", channel)
multiline("(" + nick + ") HTTP " + str(e.status_code), channel) else:
multiline("(" + nick + ") HTTP " + str(e.status_code), channel)
except:
print(traceback.format_exc())
elif "JOIN" in text and "#nixsanctuary" in text: elif "JOIN" in text and "#nixsanctuary" in text:
nick = text.split(":")[1].split("!")[0] nick = text.split(":")[1].split("!")[0]
if not "swee" in nick: if not "swee" in nick: