#!/usr/bin python # -*- coding: utf-8 -*- from twitter import TwitterAPI import time import sys from random import Random # TwitterAPIを利用するインスタンス取得 twitter = TwitterAPI() api = twitter.get_api() if (len(sys.argv) != 2): print "start bot" text = [] sleepMin = 2 # つぶやきのテキスト取得 postData = open('resource/postData.txt', 'r') for line in postData: text.append(line) # 一定時間ごとにつぶやき temp = text random = Random() id = 0 while(True): if(temp.count < 2): temp = text time.sleep(sleepMin * 60) # テキストデータの中からつぶやき post = random.choice(temp) twitter.update_status(post) temp.remove(post)