123456789101112131415161718192021222324252627282930313233343536373839404142 |
- # coding: utf8
- import ConfigParser
- from mysql import noaMysql
- from irc import noaIRC
- config = ConfigParser.ConfigParser()
- config.readfp(open('config.ini'))
- connectionSection = 'connection'
- mySQLsection = 'mysql'
- # connection to IRC
- ircCredentials = {
- 'host' : config.get(connectionSection, 'host'),
- 'port' : int(config.get(connectionSection, 'port')),
- 'key' : config.get(connectionSection, 'key'),
- 'user' : config.get(connectionSection, 'nick'),
- 'channel' : config.get(connectionSection, 'channel')
- }
- #patterns
- message_pattern = config.get('pattern', 'chat_message')
- # connection to MySQL
- mysqlCredentials = {
-
- 'host' : config.get(mySQLsection, 'host'),
- 'port' : int(config.get(mySQLsection, 'port')),
- 'user' : config.get(mySQLsection, 'user'),
- 'passwd' : config.get(mySQLsection, 'passwd'),
- 'db' : config.get(mySQLsection, 'db')
- }
- mysqlCore = noaMysql(mysqlCredentials)
- ircCore = noaIRC(**ircCredentials)
- ircCore.setMySQLconnector(mysqlCore)
- ircCore.setPattern(message_pattern)
- ircCore.run()
|