def shitposting(args): # almost entirely automated shitposting m = re.search(r"from /([0-9a-z]{1,3})/", " ".join(args["args"])) print m if m: board = args["args"][1] shitpost = fourchan_json.get_random_post(board) else: shitpost = fourchan_json.get_random_post("") shitpost = shitpost.split("\x0f") res_shitpost = [] for l in shitpost: if l.strip().startswith(">"): l = tcol.DARK_GREEN + l res_shitpost.append(l) shitpost = "\x0f".join(res_shitpost) if args["command"].isupper(): shitpost = shitpost.upper() print shitpost return shitpost
def shitposting(args): # almost entirely automated shitposting shitpost = fourchan_json.get_random_post(args) res_shitpost = [] for l in shitpost.splitlines(): l = l.strip() if l.startswith(">"): l = tcol.DARK_GREEN + l + tcol.NORMAL res_shitpost.append(l) shitpost = " ".join(res_shitpost) if args["command"].isupper(): shitpost = shitpost.upper() return shitpost
def shitposting(args): # almost entirely automated shitposting shitpostinit = fourchan_json.get_random_post() shitpost = "" i = 0 print len(shitpostinit) while i < len(shitpostinit): if shitpostinit[i] == ">": if i is not 0 or 1: prev = shitpost[:i+1] + tcol.DARK_GREEN + u" " shitpost = prev + shitpostinit[i:] else: shitpost = tcol.DARK_GREEN + shitpostinit i += 1 if args["command"].isupper(): shitpost = shitpost.upper() return shitpost
def shitposting(args): # almost entirely automated shitposting if " ".join(args["args"]) == "| tweet": directory = os.path.dirname(__file__) with open(directory + "/shitpost.txt", 'r') as twit: shitpost = twit.read()[0:140] return twitter(shitpost) shitpost = fourchan_json.get_random_post(args) shitpost = shitpost.split("\x0f") res_shitpost = [] for l in shitpost: if l.strip().startswith(">"): l = tcol.DARK_GREEN + l res_shitpost.append(l) shitpost = "\x0f".join(res_shitpost) if args["command"].isupper(): shitpost = shitpost.upper() directory = os.path.dirname(__file__) with open(directory + "/shitpost.txt", 'w') as tweet: tweet.write(shitpost) return shitpost