Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket, random
- import datetime, time
- HOST = "irc.twitch.tv"
- PORT = 6667
- NICK = ""
- PASS = ''
- def send_message(m):
- s.send(bytes("PRIVMSG #" + "cowsep" + " :" + m + "\r\n", "UTF-8"))
- s = socket.socket()
- s.connect((HOST, PORT))
- s.send(bytes("PASS " + PASS + "\r\n", "UTF-8"))
- s.send(bytes("NICK " + NICK + "\r\n", "UTF-8"))
- s.send(bytes("JOIN #" + "cowsep" + " \r\n", "UTF-8"))
- while True:
- line = str(s.recv(1024))
- if "End of /NAMES list" in line:
- break
- while True:
- # Date
- dt = str(datetime.datetime.today())
- timed = dt.split(".")
- for line in str(s.recv(1024)).split('\\r\\n'):
- print(line)
- parts = line.split(':')
- if len(parts) < 3:
- continue
- if "QUIT" not in parts[1] and "JOIN" not in parts[1] and "PART" not in parts[1]:
- message = parts[2][:len(parts[2])]
- usernamesplit = parts[1].split("!")
- username = usernamesplit[0]
- print(username + ": " + message)
- #Log
- writelog = open(r"C:\Users\Hieu\Desktop\TwitchLog.txt", "a+")
- writelog.write(timed[0] + " " + username + ": " + message + "\n")
- writelog.close()
- if "PING :tmi.twitch.tv" in line:
- s.send(bytes(line.replace("PING", "PONG") + "\r\n", "UTF-8"))
- # Messages response
- ''' d = random.randint(0, 1)
- if "ihaveamienoods" in username:
- if d == 0 :
- send_message("smd " + username + " cowcat")
- elif d == 1 :
- send_message("Ischa has smegma cowcat")
- elif "xes_lana" in username:
- if d == 0 :
- send_message("smd " + username + " cowcat")
- elif d == 1:
- send_message("have fun with your hubby amie cowcat")
- '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement