added underscore stripping

This commit is contained in:
Shauna 2014-01-11 19:29:39 -05:00
parent 603c054072
commit 2d32512c30
2 changed files with 24 additions and 6 deletions

10
bot.py
View File

@ -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))

View File

@ -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

1 paulproteus
2 britta
3 aldeka
shauna
4 ArcTanSusan
5 aeva
6 daveeloo2
13 JasonWoof
14 jdunck
15 jeremyb
16 jesstess_ jesstess
17 johnmorr
18 judytuna
19 keturn
43 Rsouthee
44 rihnapstor
45 fijal
46 kstar
47 freedeb
48 aaron
49 reutest
50 willingc
51 romzy
52 ArcTanSusan
53 paroneayea
54 wolftune
55 reutest
56 IShadowed
57 FHaag
58 Eldanen
59 exor674
60 shauna
61 Aaron1011
62 FHaag1