Skip to content
Permalink
Browse files

move config to ini file

  • Loading branch information...
Stefan
Stefan committed Jan 28, 2014
1 parent a7d110d commit 645a557ca7d8f4a1245d0d5cb5c9dc909a0e5259
Showing with 20 additions and 10 deletions.
  1. +1 −0 .gitignore
  2. +19 −10 spacebot.py
@@ -1,6 +1,7 @@
*.py[cod]
*~
*.swp
spacebot.ini

# C extensions
*.so
@@ -1,5 +1,8 @@
from jabberbot import JabberBot, botcmd
from chatterbotapi import ChatterBotFactory, ChatterBotType
from ConfigParser import ConfigParser
from jabberbot import JabberBot, botcmd
import logging


class SpaceBot(JabberBot):

@@ -29,14 +32,20 @@ def status(self, mess, args):


if __name__ == '__main__':
username = 'horscht@terminal21.de'
password = ''
chatroom = 'discuss@conference.terminal21.de'
logging.basicConfig(level=logging.DEBUG)

factory = ChatterBotFactory()
cbot = factory.create(ChatterBotType.CLEVERBOT)
csession = cbot.create_session()
config = ConfigParser()
config.read('etc/spacebot.ini')
username = str(config.get('spacebot', 'username'))
password = config.get('spacebot', 'password')
chatroom = config.get('spacebot', 'chatroom')

bot = SpaceBot(csession, username, password)
bot.join_room(chatroom)
bot.serve_forever()
factory = ChatterBotFactory()
cleverbot = factory.create(ChatterBotType.CLEVERBOT)
cleversession = cleverbot.create_session()

print dir(username)
print dir(password)
spacebot = SpaceBot(cleversession, username, password)
spacebot.join_room(chatroom)
spacebot.serve_forever()

0 comments on commit 645a557

Please sign in to comment.
You can’t perform that action at this time.