I believe it does, I wrote two different versions of this BOT. (2nd version below)
import socket, string, re
HOST = "irc.twitch.tv"
NICK = "FrostyBOT"
PORT = 6667
PASS = "oauth:xxxxxxxxxxxxxxxxxxxxxxxxx"
readbuffer = ""
MODT = False
s = socket.socket()
s.connect((HOST, PORT))
s.send("PASS " + PASS + "\r\n")
s.send("NICK " + NICK + "\r\n")
s.send("JOIN #thefrosty0806 \r\n")
def Send_message(message):
s.send("PRIVMSG #thefrosty0806 :" + message + "\r\n")
while True:
readbuffer = readbuffer + s.recv(1024)
temp = string.split(readbuffer, "\n")
readbuffer = temp.pop()
for line in temp:
# Checks whether the message is PING because its a method of Twitch to check if you're afk
if (line[0] == "PING"):
s.send("PONG %s\r\n" % line[1])
else:
# Splits the given string to work with it better
parts = string.split(line, ":")
if "QUIT" not in parts[1] and "JOIN" not in parts[1] and "PART" not in parts[1]:
try:
message = parts[2][:len(parts[2]) - 1]
except:
message = ""
usernamesplit = string.split(parts[1], "!")
username = usernamesplit[0]
if MODT:
print username + ": " + message
#Adding Plain Commands
if message == "!bot":
Send_message("This is a BOT to for my seminar class")
for l in parts:
if "End of /NAMES list" in l:
MODT = True
The only thing I changed in version 2 was
message = parts[2][:len(parts[2]) - 1]
this works, but it cannot read inputs such as https://google.com (anything that comes after “http” it wont read)
but this version sends message just fine.