Example #1
0
    def tweet_oh(self, nick, channel):
        if nick == self.bot.nick:
            return "Nobody needs to know what I say"

        last_message = self.messages[channel].get(nick, '')

        if not last_message:
            return "%s hasn't said anything yet" % nick
        else:
            # Account for 4 characters - OH:<space>
            msg = "OH: %s" % message_max(last_message, 136)
            resp = tweet(msg)

            # No over tweeting
            try:
                del self.messages[channel][nick]
            except KeyError:
                # Hey, we tried
                pass

            if not resp:
                resp = '%(nick)s that probably did not work'

            return resp
Example #2
0
    def tweet_oh(self, nick, channel):
        if nick == self.bot.nick:
            return "Nobody needs to know what I say"

        last_message = self.messages[channel].get(nick, '')

        if not last_message:
            return "%s hasn't said anything yet" % nick
        else:
            # Account for 4 characters - OH:<space>
            msg = "OH: %s" % message_max(last_message, 136)
            resp = tweet(msg)

            # No over tweeting
            try:
                del self.messages[channel][nick]
            except KeyError:
                # Hey, we tried
                pass

            if not resp:
                resp = '%(nick)s that probably did not work'

            return resp
Example #3
0
def test_message_max_handles_unicode():
    snowman1 = u'☃' * 255
    snowman2 = u'☃'
    assert len(twitter.message_max(snowman1, 140)) == 140
    assert len(twitter.message_max(snowman2, 140)) == 1
Example #4
0
def test_message_max():
    msg1 = 'a' * 255
    msg2 = 'a'
    assert len(twitter.message_max(msg1, 140)) == 140
    assert len(twitter.message_max(msg2, 140)) == 1
Example #5
0
def test_message_max_handles_unicode():
    snowman1 = u'☃' * 255
    snowman2 = u'☃'
    assert len(twitter.message_max(snowman1, 140)) == 140
    assert len(twitter.message_max(snowman2, 140)) == 1
Example #6
0
def test_message_max():
    msg1 = 'a' * 255
    msg2 = 'a'
    assert len(twitter.message_max(msg1, 140)) == 140
    assert len(twitter.message_max(msg2, 140)) == 1