Extended configuration file with projects to follow.

This commit is contained in:
Christian P. MOMON 2019-08-22 02:05:21 +02:00 committed by root
parent 0bad25ed8c
commit f7bf8fab7e
2 changed files with 26 additions and 8 deletions

View File

@ -1,5 +1,11 @@
[IRCSection]
irc.server=irc.eu.freenode.net
irc.nickname=agirbot
irc.nickname=agirbot-test
irc.registered=True
irc.password=xxxxxxxxxxxxxxxxxxx
irc.password=xxxxxxxxxxxxxxxxxxxx
irc.projects.1.id=admins
irc.projects.1.channel=#april-admin
irc.projects.2.id=
irc.projects.2.channel=
irc.projects.3.id=
irc.projects.3.channel=

View File

@ -21,10 +21,18 @@ if os.path.isfile(configurationFilename):
config = ConfigParser.RawConfigParser()
config.read(configurationFilename)
default_server=config.get('IRCSection', 'irc.server')
default_nickname=config.get('IRCSection', 'irc.nickname');
registered=config.get('IRCSection', 'irc.registered');
password=config.get('IRCSection', 'irc.password');
default_server=config.get("IRCSection", "irc.server")
default_nickname=config.get("IRCSection", "irc.nickname");
registered=config.get("IRCSection", "irc.registered");
password=config.get("IRCSection", "irc.password");
projectId1=config.get("IRCSection", "irc.projects.1.id");
projectChannel1=config.get("IRCSection", "irc.projects.1.channel");
projectId2=config.get("IRCSection", "irc.projects.2.id");
projectChannel2=config.get("IRCSection", "irc.projects.2.channel");
projectId3=config.get("IRCSection", "irc.projects.3.id");
projectChannel3=config.get("IRCSection", "irc.projects.3.channel");
else:
print "Missing configuration file."
sys.exit()
@ -196,8 +204,12 @@ def main():
print datetime.datetime.now().isoformat() + " redmine bot starting…"
redmine_bot = Bot(default_server, default_nickname)
redmine_bot.connect()
redmine_bot.add_project(Project('gdtc','#gdtc'))
redmine_bot.add_project(Project('admins','#april-admin'))
if projectId1 and projectChannel1:
redmine_bot.add_project(Project(projectId1, projectChannel1))
if projectId2 and projectChannel2:
redmine_bot.add_project(Project(projectId2, projectChannel2))
if projectId3 and projectChannel3:
redmine_bot.add_project(Project(projectId3, projectChannel3))
return redmine_bot.loop()