does not greet nicks who leave quickly

This commit is contained in:
Shauna 2014-01-30 15:20:41 -05:00
parent 32812dd656
commit c3f6f90c33
1 changed files with 14 additions and 11 deletions

7
bot.py
View File

@ -57,12 +57,10 @@ def makeNickArray(): # On startup, makes array of nicks from Nicks.txt. New in
for row in nicksData:
nickArray.append(row)
return nickArray
# Do I need to explicitly close this file?
def addPerson(person): # Adds newcomer to list of known nicks
person = person.replace("_","")
nickArray.append([person])
print nickArray
with open('nicks.csv', 'a') as csvfile:
nickwriter = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL)
nickwriter.writerow([person])
@ -114,6 +112,11 @@ while 1: # Loop forever
if actor not in (i.nick for i in newList):
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
if ircmsg.find(botnick) != -1 and ircmsg.find("PRIVMSG") != -1: # If someone talks to (or refers to) the bot
chan = channel