From 2d32512c30d4c065c016812a6b8a71ed76a5d9e5 Mon Sep 17 00:00:00 2001 From: Shauna Date: Sat, 11 Jan 2014 19:29:39 -0500 Subject: [PATCH] added underscore stripping --- bot.py | 10 ++++++---- nicks.csv | 20 ++++++++++++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/bot.py b/bot.py index a384487..25504c1 100644 --- a/bot.py +++ b/bot.py @@ -2,6 +2,7 @@ import socket import time import csv +import string import Queue import random from threading import Thread @@ -47,7 +48,7 @@ def help(actor): # This function explains what the bot is when queried. ircsock.send("PRIVMSG " + channel +" :I'm a bot! I'm from here: https://github.com/shaunagm/oh-irc-bot. You can change my behavior by submitting a pull request or by talking to shauna. \n") def welcome(newcomer): # This welcomes a specific person. - ircsock.send("PRIVMSG "+ channel +" :Welcome "+ newcomer + "! The channel's pretty quiet right now, so I thought I'd say hello, and ping my maintainers (shauna, paulproteus) that you're here. If no one responds for a while, try emailing us at hello@openhatch.org or just coming back later. FYI, you're now on my list of known nicknames, so I won't bother you again.\n") + ircsock.send("PRIVMSG "+ channel +" :Welcome "+ newcomer + "! The channel's pretty quiet right now, so I thought I'd say hello, and ping some people (like shauna, paulproteus, marktraceur) that you're here. If no one responds for a while, try emailing us at hello@openhatch.org or just coming back later. FYI, you're now on my list of known nicknames, so I won't bother you again.\n") def makeNickArray(): # On startup, makes array of nicks from Nicks.txt. New info will be written to both array and txt file. nickArray = [] @@ -59,12 +60,13 @@ def makeNickArray(): # On startup, makes array of nicks from Nicks.txt. New in # Do I need to explicitly close this file? def addPerson(person): # Adds newcomer to list of known nicks - nickArray.append(person) + 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]) - # Startup ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ircsock.connect((server, 6667)) # Here we connect to the server using the port 6667 @@ -108,7 +110,7 @@ while 1: # Loop forever if ircmsg.find("JOIN "+ channel) != -1: # If someone joins #channel if actor != botnick: # Remove the case where the bot gets a message that the bot has joined. - if actor not in nickArray: + if [actor.replace("_","")] not in nickArray: if actor not in (i.nick for i in newList): newList.append(newcomer(actor)) diff --git a/nicks.csv b/nicks.csv index 5585b94..0dd31db 100644 --- a/nicks.csv +++ b/nicks.csv @@ -1,7 +1,6 @@ paulproteus britta aldeka -shauna ArcTanSusan aeva daveeloo2 @@ -14,7 +13,7 @@ IShadowed JasonWoof jdunck jeremyb -jesstess_ +jesstess johnmorr judytuna keturn @@ -44,3 +43,20 @@ wolftune Rsouthee rihnapstor fijal +kstar +freedeb +aaron +reutest +willingc +romzy +ArcTanSusan +paroneayea +wolftune +reutest +IShadowed +FHaag +Eldanen +exor674 +shauna +Aaron1011 +FHaag1