diff --git a/dr.botzo.py b/dr.botzo.py index 75c1eb3..15ffca8 100644 --- a/dr.botzo.py +++ b/dr.botzo.py @@ -50,9 +50,10 @@ class DrBotServerConnection(irclib.ServerConnection): splitpos = text.rfind(' ', 0, splitspace) splittext = text[0:splitpos] + ' ' + splitter text = splitter + ' ' + text[splitpos+1:] - try: - splittext = unicode(splittext).encode('utf-8') - except UnicodeDecodeError: pass + # unnecessary? + #try: + # splittext = unicode(splittext).encode('utf-8') + #except UnicodeDecodeError: pass self.send_raw("PRIVMSG %s :%s" % (target, splittext)) times = times + 1 @@ -60,14 +61,16 @@ class DrBotServerConnection(irclib.ServerConnection): return # done splitting - try: - text = unicode(text).encode('utf-8') - except UnicodeDecodeError: pass + # unnecessary? + #try: + # text = unicode(text).encode('utf-8') + #except UnicodeDecodeError: pass self.send_raw("PRIVMSG %s :%s" % (target, text)) else: - try: - text = unicode(text).encode('utf-8') - except UnicodeDecodeError: pass + # unnecessary? + #try: + # text = unicode(text).encode('utf-8') + #except UnicodeDecodeError: pass self.send_raw("PRIVMSG %s :%s" % (target, text)) class DrBotIRC(irclib.IRC): diff --git a/modules/Twitter.py b/modules/Twitter.py index b0d86a3..aa16ca5 100644 --- a/modules/Twitter.py +++ b/modules/Twitter.py @@ -84,7 +84,7 @@ class Twitter(Module): if whats[1] == 'status' and len(whats) == 3: try: tweet = self.twit.GetStatus(whats[2]) - return self.reply(connection, replypath, tweet.user.name + ': ' + tweet.text) + return self.reply(connection, replypath, tweet.user.name.encode('utf-8', 'ignore') + ': ' + tweet.text.encode('utf-8', 'ignore')) except twitter.TwitterError as e: return self.reply(connection, replypath, 'Couldn\'t obtain status: ' + str(e)) elif whats[1] == 'user' and len(whats) == 3: @@ -95,7 +95,7 @@ class Twitter(Module): tweets = self.twit.GetUserTimeline(screen_name=whats[2], count=30, include_rts=False) if tweets: tweet = tweets[0] - return self.reply(connection, replypath, tweet.user.name + ': ' + tweet.text) + return self.reply(connection, replypath, tweet.user.name.encode('utf-8', 'ignore') + ': ' + tweet.text.encode('utf-8', 'ignore')) except twitter.TwitterError as e: return self.reply(connection, replypath, 'Couldn\'t obtain status: ' + str(e))