Skip to content

Commit

Permalink
リプライの翻訳機能が動作しない不具合を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo82148 committed Mar 28, 2012
1 parent a8201b3 commit 7ee5935
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion JO_RI_bot.py
Expand Up @@ -24,7 +24,7 @@
class GlobalCloneBot(CloneBot):
def __init__(self, crawl_user, mecab=None, log_file='crawl.tsv', db_file='bigram.db', crawler_api=None):
super(GlobalCloneBot, self).__init__(crawl_user, mecab, log_file, db_file, crawler_api)
self.translator = Translator(config.BING_APP_KEY, 'ja', 'en')
self.translator = Translator(config.BING_APP_KEY, 'ja', 'en').translator

def reply_hook(self, bot, status):
"""適当にリプライを返してあげる"""
Expand Down Expand Up @@ -121,6 +121,13 @@ def __init__(self):
self.append_cron('00 7-23 * * *',
self.clone_bot.update_status,
name=u'Cron Update Status')
self.append_cron('30 11 * * *',
self.bot_attack,
name=u'Cron Bot Attack')

def bot_attack(self, bot):
name = random.choice(['aokcub_bot', 'FUCOROID', 'aokcub_bot', 'FUCOROID', 'JO_RI'])
bot.update_status('@%s %s' % (name, self.clone_bot.get_text()))

def on_start(self):
self.clone_bot.crawl(self)
Expand Down

0 comments on commit 7ee5935

Please sign in to comment.