[boobot] add a check_twitter method

This commit is contained in:
Bezleputh 2014-09-05 13:55:10 +02:00
commit 3a7010f478

View file

@ -188,6 +188,7 @@ class MyThread(Thread):
self.weboob.repeat(300, self.check_board)
self.weboob.repeat(600, self.check_dlfp)
self.weboob.repeat(600, self.check_twitter)
self.weboob.loop()
@ -202,6 +203,14 @@ class MyThread(Thread):
return word
return None
def check_twitter(self):
for backend, thread in self.weboob.do('iter_resources', objs=None,
split_path=['search', 'weboob'], backends=['twitter']):
_item = thread.id.split('#')
self.bot.send_message('%s: https://twitter.com/%s/status/%s' % (_item[0],
_item[0], _item[1]))
backend.set_message_read(backend.fill_thread(thread, ['root']).root)
def check_dlfp(self):
for backend, msg in self.weboob.do('iter_unread_messages', backends=['dlfp']):
word = self.find_keywords(msg.content)