/shoot
Nya
Nyanyanyanyanyanya
/shoot
Nyanyanyanyanyanya
/shoot @Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you
/shoot GAY SEX
interesting
/shoot @shoot
Is this related automated tho
/shoot Litten
Of course it’s automated
did I need to reply
yes
from playwright.sync_api import Playwright, sync_playwright, expect
import time
import re
import determine_last_post
import get_new_posts
import post as p
import os
import random
topicNumber = 7394
topicNumberString = str(topicNumber)
threadFirstPostLink = "https://www.fortressoflies.com/t/100-000th-poster-gets-a-cookie-9966th-poster-gets-a-cookie-katze-opposition-thread-part-4/7394/1"
threadLink = "https://www.fortressoflies.com/t/100-000th-poster-gets-a-cookie-9966th-poster-gets-a-cookie-katze-opposition-thread-part-4/7394/10000"
player_with_gun = 'Zugzwang'
players_to_shoot = ['May', 'Zugzwang', 'Katze']
players_to_shoot = list(map(lambda x : x.lower(), players_to_shoot))
name_to_role = {'may' : "Wolf", 'zugzwang' : "Town", "katze" : "Jester"} #all names here must be lowercase
overall_flip_path = r"C:\Users\[Litten gotta try harder to dox me]\OneDrive\Desktop\Automated Discourse Posts\flip_storage"
def getFlip(playername: str) -> str:
"""
Given a playername, returns the role of that player.
Will crash if given an invalid playername.
"""
try:
role = name_to_role[playername.lower()]
except:
role = name_to_role[random.choice(players_to_shoot).lower()]
filepath = os.path.join(overall_flip_path, f"{role}.txt")
flipfile = open(filepath, 'r')
flip = flipfile.read()
flipfile.close()
return flip
def run(playwright: Playwright) -> None:
startTime = time.time()
browser = playwright.chromium.launch(headless=False)
context = browser.new_context()
page = context.new_page()
page.goto(threadLink)
page.get_by_role("button", name="Log In").click()
page.get_by_label("Email / Username").fill("Zugzwang")
page.get_by_label("Email / Username").press("Tab")
page.get_by_label("Password").fill("not telling litten my password lol nice try")
page.get_by_label("Password").press("Enter")
time.sleep(3)
lastPostAccessed = 1
last_page = 1
discard, lastPostAccessed, last_page = get_new_posts.getNewPosts(topicNumberString, threadLink, lastPostAccessed, last_page)
print(lastPostAccessed)
print(type(lastPostAccessed))
assert type(lastPostAccessed) == int
assert type(last_page) == int
daykillHappened = False
newPosts = []
while(not daykillHappened):
if len(newPosts) == 0:
newPosts, lastPostAccessed, last_page = get_new_posts.getNewPosts(topicNumberString, threadLink, lastPostAccessed, last_page)
assert type(lastPostAccessed) == int
assert type(last_page) == int
try:
assert type(newPosts) == list[p.Post]
except:
assert type(newPosts) == list
moveMatcher = re.compile(r"/shoot @([^ ][^ ]*)", re.IGNORECASE)
target = None
while len(newPosts) > 0:
print(f"New posts remaining: {len(newPosts)}")
post = newPosts.pop(0)
print(f"Post content: {post.content}")
if True or post.poster == player_with_gun:
target = moveMatcher.search(post.content)
if target is not None:
break
if target is None:
time.sleep(6)
continue
print("Here")
targetName = target.group(1)
try:
page.goto(threadFirstPostLink)
time.sleep(10)
page.get_by_label("post #1", exact=True).get_by_role("button", name="Reply", exact=True).click()
text_box = page.get_by_placeholder("Type here. Use Markdown,")
if True or targetName.lower() in players_to_shoot:
string_to_post = f"{targetName} has been daykilled! \n {getFlip(targetName)} \n <small>automated post</small>"
# else:
# string_to_post = f"Shot on {targetName} is not valid; their name may be mispelled. \n <small>automated post</small>"
text_box.fill(string_to_post)
page.get_by_title("Or press Ctrl+Enter").click()
except Exception as e:
print(e)
currentTime = time.time()
if currentTime - startTime > 60 * 60 * 2:
break
# ---------------------
context.close()
browser.close()
with sync_playwright() as playwright:
run(playwright)
# board = Board()
# while(True):
# print(eval(input()))
/Shoot @@.
/shoot VOTE: MAY
/shoot [quote=“May, post:6980, topic:7394, full:true”]
/shoot VOTE: MAY
[/quote]