Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket, string, time, re, random
- # Set all the variables necessary to connect to Twitch IRC
- HOST = "irc.twitch.tv"
- NICK = "calus14"
- PORT = 6667
- PASS = "oauth:frct1uinrqvb3gz7udzqybxrm7ne8k"
- MODT = False
- CHANNELNAME = "kaia"
- # Connecting to Twitch IRC by passing credentials and joining a certain channel
- s = socket.socket()
- s.connect((HOST, PORT))
- s.send("PASS " + PASS + "\r\n")
- s.send("NICK " + NICK + "\r\n")
- s.send("JOIN #"+CHANNELNAME+" \r\n")
- # Method for sending a message
- def Send_message(message):
- print("sending message "+message)
- s.send("PRIVMSG #"+CHANNELNAME+" :" + message + "\r\n")
- print("Sent message")
- spamMessages = []
- with open("PickupLines.txt", 'r') as pickUpLines:
- lines = pickUpLines.readlines()
- for pickupLine in lines:
- pickupLine = pickupLine.rstrip()
- if pickupLine:
- print(pickupLine)
- spamMessages.append(pickupLine)
- with open("DadJokes.txt", 'r') as dadJokes:
- jokes = dadJokes.readlines()
- for joke in jokes:
- joke = joke.rstrip()
- if joke:
- print(joke)
- spamMessages.append(joke)
- while True:
- print("Listening")
- readbuffer = s.recv(1024).decode("utf-8")
- print("got something "+readbuffer)
- temp = string.split(readbuffer, "\n")
- for line in temp:
- print(line)
- # Checks whether the message is PING because its a method of Twitch to check if you're afk
- if "PING" in line:
- s.send("PONG :tmi.twitch.tv\r\n")
- else:
- Send_message(random.choice(spamMessages))
- time.sleep(300)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement