This commit is contained in:
Auric Vente 2024-04-10 12:08:32 -06:00
parent f237d66c0d
commit ba17a48c00
1 changed files with 6 additions and 3 deletions

View File

@ -297,7 +297,7 @@ async def on_message(ws, message):
elif cmd in ["post", "shitpost", "4chan", "anon", "shit"]: elif cmd in ["post", "shitpost", "4chan", "anon", "shit"]:
update_time() update_time()
await random_post(ws, room_id) await shitpost(ws, room_id)
async def random_bird(ws, room_id): async def random_bird(ws, room_id):
@ -434,7 +434,7 @@ async def gif_when(who, room_id):
await run_gifmaker(command, room_id) await run_gifmaker(command, room_id)
async def random_post(ws, room_id): async def shitpost(ws, room_id):
boards = ["g", "an", "ck", "lit", "x", "tv", "v", "fit", "k", "o"] boards = ["g", "an", "ck", "lit", "x", "tv", "v", "fit", "k", "o"]
board = random.choice(boards) board = random.choice(boards)
@ -458,6 +458,7 @@ async def random_post(ws, room_id):
# Select a random post # Select a random post
post = posts[random_int(0, len(posts) - 1)] post = posts[random_int(0, len(posts) - 1)]
print(post)
html = post.get("com", "") html = post.get("com", "")
if not html: if not html:
@ -477,9 +478,11 @@ async def random_post(ws, room_id):
# Get the text content # Get the text content
text = soup.get_text(separator="\n").strip() text = soup.get_text(separator="\n").strip()
text = clean_lines(text) text = clean_lines(text)
number = "123"
url = f"https://boards.4chan.org/{board}/thread/{id}#p{number}"
if not text: if not text:
text = f"https://boards.4chan.org/{board}/thread/{id}" text = url
await send_message(ws, text, room_id) await send_message(ws, text, room_id)