Update sweebot.py
Some checks are pending
Check syntax / check (push) Waiting to run

This commit is contained in:
Nova Cat 2025-01-12 20:16:22 -08:00
parent 697a6d67fb
commit a0ef352973

View file

@ -16,6 +16,7 @@ from bs4 import BeautifulSoup
from googleapiclient.discovery import build
from characterai import pycai
import uuid
import ssl
CAItoken = environ["CAItoken"]
CAImodel = environ["CAIchara"]
try:
@ -846,6 +847,39 @@ while True:
multiline("(" + nick + ") [Request error: " + str(ex.message) + "]", channel)
except:
print(traceback.format_exc())
elif sbconfig.cflagexist(channel, "+links") or sbconfig.cflagexist(channel, "+gemini"):
try:
for i in command:
parse = urlparse(i)
if parse.scheme == "gemini":
gsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
gemsocket = ssl.wrap_socket(gsocket)
gemsocket.connect((parse.hostname, 1965))
wrappedSocket.send(i + "\r\n")
received = ""
while True:
gemresponse = wrappedSocket.recv(2048)
if gemresponse:
received += gemresponse.decode()
else:
break
received = received.replace("\r", "")
firstline = True
title = False
for i in received.split("\n"):
if firstline:
if i.split(" ")[0][0] != "2"
multiline("(" + nick + f") [{i}]", channel)
break
else:
firstline = False
else:
elif i.split(" ")[0][0] == "#":
title = True
multiline("(" + nick + f") " + i[2:], channel)
break
if not title:
multiline("(" + nick + f") [No title found]", channel)
elif "JOIN" in text and "#nixsanctuary" in text:
nick = text.split(":")[1].split("!")[0]
if not "Meow" in nick: