コード例 #1
0
ファイル: run.py プロジェクト: zacc/ssi-bot
def main():

    # enable minimal logging
    logging.basicConfig(level=logging.INFO)

    # Create the database. If the table already exists, nothing will happen
    create_db_tables()

    # initialise reddit_io
    reddit_io = RedditIO()
    # synchronize bot's own posts to the databse
    reddit_io.synchronize_bots_comments_submissions()

    # Start the reddit IO daemon which will pick up incoming
    # submissions/comments and send outgoing ones
    reddit_io.start()

    # Start the text generation daemon
    mtg = ModelTextGenerator()
    mtg.start()

    # Set up a game loop
    # Cancel it with Ctrl-C
    try:
        while True:
            time.sleep(5)
    except KeyboardInterrupt:
        logging.info('Shutdown')