Alright, so my daughter got hooked on to this Trick or Treat craziness on Discord, and honestly I also found it amusing.
Not to cheat, I wanted to see if I could write a script in python to quickly help me type and get ahead of anyone.
It worked ! 10 Minutes of Scripting and it can get you endless cheating. I did collect 5 goodies , and then killed the script. What’s the fun in cheating, but this was enough to show my daughter the power of python.
Here is the script. Offcourse you would need the selenium chromedriver and python to run this .
import selenium ; from selenium import webdriver from selenium.webdriver.common.keys import Keys import keyboard dr=webdriver.Chrome(executable_path="c:/chromedriver.exe") # in this window,login to Discourse def cheat(my_key): input_field = dr.find_element_by_xpath('//*[@id="app-mount"]/div/div/div/div/div/div/div/div/div/main/form/div/div/div/div/div/div') input_field.send_keys(my_key) input_field.send_keys(Keys.ENTER) def t(): latest= (dr.find_elements_by_class_name("username-1A8OIy")[-1]).get_attribute('innerHTML') if latest == "Trick'cord Treat" : print(".",end='') msg = (dr.find_elements_by_class_name("container-1ov-mD")[-1]).get_attribute('innerHTML') if "h!trick" in msg : cheat("h!trick") if "h!treat" in msg : cheat("h!treat") while True: t() #press b to break the loop if keyboard.is_pressed('b'):break