예제 #1
0
파일: irc.py 프로젝트: miri64/spline_social
 def do_delete(self, argument):
     if argument == 'last':
         posts = Post.get_last(1)
         if len(posts) > 0:
             status_id = posts[0].status_id
         else:
             reply = "%s, I don't know any posts." % self._get_nick()
             if self.event.target() in self.bot.channels.keys():
                 self.conn.privmsg(self.event.target(), reply)
             else:
                 conn.privmsg(nick, reply)
             return
     elif re.match('^[0-9]+$', argument):
         status_id = int(argument)
     else:
         raise CommandHandler.UsageError('remove')
     try:
         self.bot.posting_api.DestroyStatus(
                 self.event.source(), 
                 status_id
             )
         reply = "Status %d deleted" % status_id
     except IdenticaError, e:
         if str(e).find('Status deleted') >= 0:
             reply = "Status %d already deleted." % status_id
             Post.mark_deleted(status_id)
         else:
             reply = str(e)
예제 #2
0
파일: irc.py 프로젝트: miri64/spline_social
 def do_history(self, argument = None):
     if argument == None:
         posts = Post.get_last()
     else:
         if re.match('^[0-9]{4}-[0-1][0-9]-[0-9]{2}$',argument):
             posts = Post.get_by_day(argument)
         elif argument[0] == '@':
             posts = Post.get_by_user_id(argument[1:])
         else:
             posts = Post.get_by_irc_id(argument)
     self._generate_history_replies(posts)
예제 #3
0
 def get_tweets(self, username = None, limit = 20):
     if username == None:
         posts = Post.get_last(limit)
     else:
         posts = Post.get_by_user_id(username, limit)
     return map(
             lambda x: {
                 'poster': User.get_by_user_id(x.poster_id).ldap_id, 
                 'status_id': x.status_id
             }, 
             posts
         )