From b98dac4aa9b2cccb139b1cad62c3fa157b5678c8 Mon Sep 17 00:00:00 2001 From: Alex Parella Date: Tue, 30 Dec 2014 17:23:43 -0800 Subject: [PATCH] Add welcome_message configuration to settings.ini --- bot.py | 6 +++--- nicks.csv | 2 ++ settings.ini | 11 ++++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/bot.py b/bot.py index a9ead72..1a8a51a 100644 --- a/bot.py +++ b/bot.py @@ -17,8 +17,9 @@ help_list = [r'help', r'info', r'faq', r'explain yourself'] # Defines a bot class Bot(object): - def __init__(self, botnick, nick_source='nicks.csv', wait_time=60): + def __init__(self, botnick, welcome_message, nick_source='nicks.csv', wait_time=60): self.botnick = botnick + self.welcome_message = welcome_message self.nick_source = nick_source self.wait_time = wait_time self.known_nicks = [] @@ -65,7 +66,6 @@ def parsesettings(): for option in parser.options(section): settings[option] = parser.get(section, option) - print(settings) return settings # Creates a socket that will be used to send and receive messages, @@ -236,7 +236,7 @@ def main(): settings = parsesettings() ircsock = irc_start(settings["server"]) join_irc(ircsock, settings["botnick"], settings["channel"]) - WelcomeBot = Bot(settings["botnick"]) + WelcomeBot = Bot(settings["botnick"], settings["welcome_message"]) while 1: # Loop forever ready_to_read, b, c = select.select([ircsock],[],[], 1) # b&c are ignored here process_newcomers(WelcomeBot, [i for i in WelcomeBot.newcomers if i.around_for() > WelcomeBot.wait_time],ircsock,settings["channel"], settings["channel_greeters"].split(",")) diff --git a/nicks.csv b/nicks.csv index 0e56c9e..5a258a7 100644 --- a/nicks.csv +++ b/nicks.csv @@ -73,3 +73,5 @@ MaraJade achock aaparella abcqfiojqw +somethingsoemthi +blahblahbloo diff --git a/settings.ini b/settings.ini index 78164e2..8772c30 100644 --- a/settings.ini +++ b/settings.ini @@ -1,4 +1,9 @@ +; Replace these default settings with your own personal settings [Configurations] -channel: #openhatch-bots -botnick: welcomebot -server: irc.freenode.net +channel : #openhatch-bots +botnick : parsewelcomebot +server : irc.freenode.net +channel_greeters : shauna,paulproteus,marktraceur +hello_list : hello,hi,hey,yo,sup +help_list : help,info,faq,explain_yourself +welcome_message : Welcome! THe channel is pretty quiet right now, so I thought I'd say hello, and ping some people that you're here. If no one responds for a whle, try emailing us at hello@openhatch.org or just try coming back later. FYI, you're now on my list of known nicknames, so I won't bother you again.