Mods
This commit is contained in:
parent
fd31afa4b7
commit
3365aac6af
6
main.py
6
main.py
|
@ -205,7 +205,7 @@ async def on_message(ws, message):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = json.loads(message)
|
data = json.loads(message)
|
||||||
except:
|
except BaseException:
|
||||||
return
|
return
|
||||||
|
|
||||||
if data["type"] == "message":
|
if data["type"] == "message":
|
||||||
|
@ -418,8 +418,8 @@ async def random_post(ws, room_id):
|
||||||
for br in soup.find_all("br"):
|
for br in soup.find_all("br"):
|
||||||
br.replace_with("\n")
|
br.replace_with("\n")
|
||||||
|
|
||||||
# Get text content and limit to 500 characters
|
# Get the text content
|
||||||
text = soup.get_text(separator="\n")[:500].strip()
|
text = soup.get_text(separator="\n").strip()
|
||||||
text = clean_lines(text)
|
text = clean_lines(text)
|
||||||
|
|
||||||
if not text:
|
if not text:
|
||||||
|
|
Loading…
Reference in New Issue