Пример #1
0
    def manual_retweet(self):
        status = self.timelines.active_status

        rt_text = ''.join([' RT @%s: ' % status.authors_username, status.text])
        if is_valid_status_text(rt_text):
            self.tweet(content=rt_text, cursor_position=0)
        else:
            self.error_message(_('Tweet too long for manual retweet'))
Пример #2
0
    def manual_retweet(self):
        status = self.timelines.active_status

        rt_text = ''.join([' RT @%s: ' % status.authors_username,
                           status.text])
        if is_valid_status_text(rt_text):
            self.tweet(content=rt_text,
                       cursor_position=0)
        else:
            self.error_message(_('Tweet too long for manual retweet'))
Пример #3
0
    def manual_retweet(self):
        status = self.timelines.get_active_status()

        if status is None:
            return

        rt_text = 'RT ' + status.text
        if is_valid_status_text(' ' + rt_text):
            self.tweet(content=rt_text)
        else:
            self.error_message(_('Tweet too long for manual retweet'))
Пример #4
0
    def tweet_handler(self, text):
        """Handle the post as a tweet of the given `text`."""
        self.info_message(_('Sending tweet'))

        if not is_valid_status_text(text):
            # tweet was explicitly cancelled or empty text
            self.info_message(_('Tweet canceled'))
            return

        tweet_sent = partial(self.info_message, _('Tweet sent'))
        tweet_not_sent = partial(self.error_message, _('Tweet not sent'))

        # API call
        self.api.update(text=text,
                        on_success=tweet_sent,
                        on_error=tweet_not_sent,)
Пример #5
0
    def tweet_handler(self, text):
        """Handle the post as a tweet of the given `text`."""
        self.info_message(_('Sending tweet'))

        if not is_valid_status_text(text):
            # tweet was explicitly cancelled or empty text
            self.info_message(_('Tweet canceled'))
            return

        tweet_sent = partial(self.info_message, _('Tweet sent'))
        tweet_not_sent = partial(self.error_message, _('Tweet not sent'))

        # API call
        self.api.update(text=text,
                        on_success=tweet_sent,
                        on_error=tweet_not_sent,)
Пример #6
0
    def direct_message_handler(self, username, text):
        """Handle the post as a DM of the given `text` to `username`."""
        self.info_message(_('Sending DM'))

        if not is_valid_status_text(text):
            # <Esc> was pressed
            self.info_message(_('DM canceled'))
            return

        dm_info = _('Direct Message to @%s sent' % username)
        dm_sent = partial(self.info_message, dm_info)
        dm_error = _('Failed to send message to @%s' % username)
        dm_not_sent = partial(self.error_message, dm_error)

        self.api.direct_message(screen_name=username,
                                text=text,
                                on_success=dm_sent,
                                on_error=dm_not_sent,)
Пример #7
0
    def direct_message_handler(self, username, text):
        """Handle the post as a DM of the given `text` to `username`."""
        self.info_message(_('Sending DM'))

        if not is_valid_status_text(text):
            # <Esc> was pressed
            self.info_message(_('DM canceled'))
            return

        dm_info = _('Direct Message to @%s sent' % username)
        dm_sent = partial(self.info_message, dm_info)
        dm_error = _('Failed to send message to @%s' % username)
        dm_not_sent = partial(self.error_message, dm_error)

        self.api.direct_message(screen_name=username,
                                text=text,
                                on_success=dm_sent,
                                on_error=dm_not_sent,)
Пример #8
0
    def reply_handler(self, text):
        """Handle the post as a tweet of the given `text` replying to the
        current status."""
        status = self.timelines.active_status

        self.info_message(_('Sending reply'))

        if not is_valid_status_text(text):
            # reply was explicitly cancelled or empty text
            self.info_message(_('Reply canceled'))
            return

        reply_sent = partial(self.info_message, _('Reply sent'))
        reply_not_sent = partial(self.error_message, _('Reply not sent'))

        # API call
        self.api.reply(status=status,
                       text=text,
                       on_success=reply_sent,
                       on_error=reply_not_sent,)
Пример #9
0
    def tweet_handler(self, text):
        """Handle the post as a tweet of the given `text`."""
        self.timeline_mode()
        self.ui.remove_editor(self.tweet_handler)
        self.ui.set_focus('body')

        self.info_message(_('Sending tweet'))

        if not is_valid_status_text(text):
            # <Esc> was pressed
            self.info_message(_('Tweet canceled'))
            return

        tweet_sent = partial(self.info_message, _('Tweet sent'))
        tweet_not_sent = partial(self.error_message, _('Tweet not sent'))

        # API call
        self.api.update(text=text, 
                        on_success=tweet_sent,
                        on_error=tweet_not_sent,)
Пример #10
0
    def reply_handler(self, text):
        """Handle the post as a tweet of the given `text` replying to the
        current status."""
        status = self.timelines.active_status

        self.info_message(_('Sending reply'))

        if not is_valid_status_text(text):
            # reply was explicitly cancelled or empty text
            self.info_message(_('Reply canceled'))
            return

        reply_sent = partial(self.info_message, _('Reply sent'))
        reply_not_sent = partial(self.error_message, _('Reply not sent'))

        # API call
        self.api.reply(status=status,
                       text=text,
                       on_success=reply_sent,
                       on_error=reply_not_sent,)