does not greet nicks who leave quickly
This commit is contained in:
parent
32812dd656
commit
c3f6f90c33
7
bot.py
7
bot.py
|
@ -57,12 +57,10 @@ def makeNickArray(): # On startup, makes array of nicks from Nicks.txt. New in
|
||||||
for row in nicksData:
|
for row in nicksData:
|
||||||
nickArray.append(row)
|
nickArray.append(row)
|
||||||
return nickArray
|
return nickArray
|
||||||
# Do I need to explicitly close this file?
|
|
||||||
|
|
||||||
def addPerson(person): # Adds newcomer to list of known nicks
|
def addPerson(person): # Adds newcomer to list of known nicks
|
||||||
person = person.replace("_","")
|
person = person.replace("_","")
|
||||||
nickArray.append([person])
|
nickArray.append([person])
|
||||||
print nickArray
|
|
||||||
with open('nicks.csv', 'a') as csvfile:
|
with open('nicks.csv', 'a') as csvfile:
|
||||||
nickwriter = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL)
|
nickwriter = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL)
|
||||||
nickwriter.writerow([person])
|
nickwriter.writerow([person])
|
||||||
|
@ -114,6 +112,11 @@ while 1: # Loop forever
|
||||||
if actor not in (i.nick for i in newList):
|
if actor not in (i.nick for i in newList):
|
||||||
newList.append(newcomer(actor))
|
newList.append(newcomer(actor))
|
||||||
|
|
||||||
|
if ircmsg.find("PART " + channel) != -1 or ircmsg.find("QUIT") != -1: # If someone parts or quits the #channel
|
||||||
|
for i in newList: # And that person is on the newlist (has entered channel within last 60 seconds)
|
||||||
|
if actor == i.nick:
|
||||||
|
newList.remove(i) # Remove them from the list
|
||||||
|
|
||||||
# Unwelcome functions
|
# Unwelcome functions
|
||||||
if ircmsg.find(botnick) != -1 and ircmsg.find("PRIVMSG") != -1: # If someone talks to (or refers to) the bot
|
if ircmsg.find(botnick) != -1 and ircmsg.find("PRIVMSG") != -1: # If someone talks to (or refers to) the bot
|
||||||
chan = channel
|
chan = channel
|
||||||
|
|
Loading…
Reference in New Issue