def joinRoom(s): readbuffer = "" bytebuffer = b'' stringbuffer = "" Loading = True while Loading: bytebuffer = s.recv(1024) stringbuffer = bytebuffer.decode('utf-8') readbuffer = readbuffer + stringbuffer temp = str.split(readbuffer, "\n") readbuffer = temp.pop() for line in temp: print(line) Loading = loadingComplete(line) sendMessage(s, str.encode("Successfully joined chat gachiGASM"))
stringbuffer = bytebuffer.decode('utf-8') readbuffer = readbuffer + stringbuffer temp = str.split(readbuffer, "\n") readbuffer = temp.pop() for line in temp: print(line) if "PING" in line: line = str.encode("PONG") s.send(line) break user = getUser(line) message = getMessage(line) print(user + " typed :" + message) if "You Suck" in message: sendMessage(s, str.encode("No, you suck!")) break if user == "nerfireliapls" and "!startgiveaway" in message: sendMessage(s, str.encode("Starting giveaway! Type !giveaway to enter!")) giveawayBool = True break if user not in userArray and giveawayBool == True and "!giveaway" in message: userArray.append(user) break if len(userArray) != 0 and user == "nerfireliapls" and "!endgiveaway" in message and giveawayBool == True: randomInt = random.randint(0, len(userArray) - 1) sendMessage(s, str.encode("Congratulations ") + userArray[randomInt] + str.encode(", you won the giveaway!")) giveawayBool = False userArray = [] break if user == "nerfireliapls" and "!AllNight" in message: