From 007f9bdbc777074525a8417535f8eac2f7b2cf3e Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sun, 17 Jan 2016 11:36:10 -0600 Subject: [PATCH 1/2] twitter: don't re-encode replyee name this appears to have been whan was causing replying via twitter to fail. let's test something while we're here: fixes #2 --- dr_botzo/twitter/ircplugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dr_botzo/twitter/ircplugin.py b/dr_botzo/twitter/ircplugin.py index 94057cb..865bad4 100644 --- a/dr_botzo/twitter/ircplugin.py +++ b/dr_botzo/twitter/ircplugin.py @@ -166,7 +166,7 @@ class Twitter(Plugin): return self.bot.reply(event, "you do not have permission to send tweets.") replyee_tweet = self.twit.show_status(id=status_id) - target = replyee_tweet['user']['screen_name'].encode('utf-8', 'ignore') + target = replyee_tweet['user']['screen_name'] try: reptweet = "@{0:s}: {1:s}".format(target, tweet) From 7a1c024d693fedeb936a1acf889ca2948b865369 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sun, 17 Jan 2016 11:39:43 -0600 Subject: [PATCH 2/2] dispatch: write message to file properly in py3 --- dr_botzo/dispatch/views.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dr_botzo/dispatch/views.py b/dr_botzo/dispatch/views.py index 394f511..faed9fe 100644 --- a/dr_botzo/dispatch/views.py +++ b/dr_botzo/dispatch/views.py @@ -90,8 +90,7 @@ class DispatchMessage(generics.GenericAPIView): filename = os.path.abspath(action.destination) log.debug("sending '%s' to file %s", text, filename) with open(filename, 'w') as f: - f.write(text.encode('utf8')) - f.write(b'\n') + f.write(text + '\n') new_data = copy.deepcopy(message.data) new_data['status'] = "OK"