So currently my problem with this bot for my Twitch channel is that it prevents me from having multiple words in 1 string while Authlist is being threated as an list.
Example: I want to ban the words foo1, foo2, foo3 and foo4 but while having them all in 1 string I need to type all 4 of them in chat in order that my bot is able to ban the person, but not if he says one of the 4 words.
Thanks in advance!
import socket
authlist = "patyyebot patyye"
banword = "foo1 foo2 foo3 foo4"
server = "patyye.jtvirc.com"
name = "patyyebot"
port = 6667
channel = "#patyye"
password = "xx"
irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
irc.connect((server, port))
irc.send("PASS " + password + "\n")
irc.send("NICK " + name + "\n")
irc.send("USER patyyebot patyyebot patyyebot :PatyYeBot\n")
irc.send("JOIN " + channel + "\n")
while True:
def message(msg):
irc.send("PRIVMSG " + channel + " :" + msg + "\n")
def ban(msg):
irc.send("PRIVMSG " + channel + " :/ban " + msg + "\n")
data = irc.recv(1204)
data = data.strip('\r\n')
senderusr = data.split(" ")
senderusr = senderusr[0]
senderusr = senderusr.split("!")
senderusr = senderusr[0]
senderusr = senderusr.strip(":")
print data
if data.find == "PONG" :
irc.send("PING")
if "!facebook" in data and senderusr in authlist:
message("@" + senderusr + ": Facebook is private")
if "!twitter" in data:
message("Follow PatyYe on Twitter: https://twitter.com/PatyYe")
if data in banword:
message("@" + senderusr + ": zei een gebanned woord! Ban uitgevoerd")
ban(senderusr)